Commit 82459bd6 by Arun Babu Neelicattu

tests: suppress unhandled thread exception warning

HTTPretty handling of thread exception is incomplete, causing issues
for test runs. This change works around the issue by ignoring the
relevant warnings.
parent 30863c01
from pathlib import Path from pathlib import Path
import pytest
import requests import requests
from poetry.publishing.uploader import UploadError from poetry.publishing.uploader import UploadError
...@@ -27,6 +28,7 @@ Publishing simple-project (1.2.3) to PyPI ...@@ -27,6 +28,7 @@ Publishing simple-project (1.2.3) to PyPI
assert expected_error_output in app_tester.io.fetch_error() 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 test_publish_returns_non_zero_code_for_connection_errors(app, app_tester, http):
def request_callback(*_, **__): def request_callback(*_, **__):
raise requests.ConnectionError() raise requests.ConnectionError()
......
...@@ -168,6 +168,7 @@ def test_authenticator_falls_back_to_keyring_netloc( ...@@ -168,6 +168,7 @@ def test_authenticator_falls_back_to_keyring_netloc(
assert "Basic OmJhcg==" == request.headers["Authorization"] assert "Basic OmJhcg==" == request.headers["Authorization"]
@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning")
def test_authenticator_request_retries_on_exception(mocker, config, http): def test_authenticator_request_retries_on_exception(mocker, config, http):
sleep = mocker.patch("time.sleep") sleep = mocker.patch("time.sleep")
sdist_uri = "https://foo.bar/files/{}/foo-0.1.0.tar.gz".format(str(uuid.uuid4())) sdist_uri = "https://foo.bar/files/{}/foo-0.1.0.tar.gz".format(str(uuid.uuid4()))
...@@ -188,6 +189,7 @@ def test_authenticator_request_retries_on_exception(mocker, config, http): ...@@ -188,6 +189,7 @@ def test_authenticator_request_retries_on_exception(mocker, config, http):
assert sleep.call_count == 2 assert sleep.call_count == 2
@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning")
def test_authenticator_request_raises_exception_when_attempts_exhausted( def test_authenticator_request_raises_exception_when_attempts_exhausted(
mocker, config, http mocker, config, http
): ):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment