Skip to content

Commit

Permalink
tests: suppress unhandled thread exception warning
Browse files Browse the repository at this point in the history
HTTPretty handling of thread exception is incomplete, causing issues
for test runs. This change works around the issue by ignoring the
relevant warnings.
  • Loading branch information
abn committed Oct 10, 2021
1 parent 30863c0 commit 82459bd
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/console/commands/test_publish.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path

import pytest
import requests

from poetry.publishing.uploader import UploadError
@@ -27,6 +28,7 @@ def test_publish_returns_non_zero_code_for_upload_errors(app, app_tester, http):
assert expected_error_output in app_tester.io.fetch_error()


@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning")
def test_publish_returns_non_zero_code_for_connection_errors(app, app_tester, http):
def request_callback(*_, **__):
raise requests.ConnectionError()
2 changes: 2 additions & 0 deletions tests/utils/test_authenticator.py
Original file line number Diff line number Diff line change
@@ -168,6 +168,7 @@ def test_authenticator_falls_back_to_keyring_netloc(
assert "Basic OmJhcg==" == request.headers["Authorization"]


@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning")
def test_authenticator_request_retries_on_exception(mocker, config, http):
sleep = mocker.patch("time.sleep")
sdist_uri = "https://foo.bar/files/{}/foo-0.1.0.tar.gz".format(str(uuid.uuid4()))
@@ -188,6 +189,7 @@ def callback(request, uri, response_headers):
assert sleep.call_count == 2


@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning")
def test_authenticator_request_raises_exception_when_attempts_exhausted(
mocker, config, http
):

0 comments on commit 82459bd

Please sign in to comment.