From ecb5d84f0f4b6c63e7b682496f152791a7399bff Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Fri, 8 Dec 2023 23:42:07 +0100 Subject: [PATCH] tests: Fix imports to tests/assertions.py --- tests/__init__.py | 0 tests/integration/test_filter.py | 3 ++- tests/integration/test_httplib2.py | 3 ++- tests/integration/test_requests.py | 3 ++- tests/integration/test_stubs.py | 4 ++-- tests/integration/test_tornado.py | 3 ++- tests/integration/test_urllib2.py | 3 ++- tests/integration/test_urllib3.py | 3 ++- 8 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/integration/test_filter.py b/tests/integration/test_filter.py index 19d2f69..f036dd4 100644 --- a/tests/integration/test_filter.py +++ b/tests/integration/test_filter.py @@ -5,10 +5,11 @@ from urllib.parse import urlencode from urllib.request import Request, urlopen import pytest -from assertions import assert_cassette_has_one_response, assert_is_json_bytes import vcr +from ..assertions import assert_cassette_has_one_response, assert_is_json_bytes + def _request_with_auth(url, username, password): request = Request(url) diff --git a/tests/integration/test_httplib2.py b/tests/integration/test_httplib2.py index 7fecd72..562c35c 100644 --- a/tests/integration/test_httplib2.py +++ b/tests/integration/test_httplib2.py @@ -3,10 +3,11 @@ from urllib.parse import urlencode import pytest import pytest_httpbin.certs -from assertions import assert_cassette_has_one_response import vcr +from ..assertions import assert_cassette_has_one_response + httplib2 = pytest.importorskip("httplib2") diff --git a/tests/integration/test_requests.py b/tests/integration/test_requests.py index 493df41..48590fc 100644 --- a/tests/integration/test_requests.py +++ b/tests/integration/test_requests.py @@ -1,9 +1,10 @@ """Test requests' interaction with vcr""" import pytest -from assertions import assert_cassette_empty, assert_is_json_bytes import vcr +from ..assertions import assert_cassette_empty, assert_is_json_bytes + requests = pytest.importorskip("requests") diff --git a/tests/integration/test_stubs.py b/tests/integration/test_stubs.py index 6b6a6e4..37a1b47 100644 --- a/tests/integration/test_stubs.py +++ b/tests/integration/test_stubs.py @@ -2,10 +2,10 @@ import http.client as httplib import json import zlib -from assertions import assert_is_json_bytes - import vcr +from ..assertions import assert_is_json_bytes + def _headers_are_case_insensitive(host, port): conn = httplib.HTTPConnection(host, port) diff --git a/tests/integration/test_tornado.py b/tests/integration/test_tornado.py index 2013088..0ba4897 100644 --- a/tests/integration/test_tornado.py +++ b/tests/integration/test_tornado.py @@ -3,11 +3,12 @@ import json import pytest -from assertions import assert_cassette_empty, assert_is_json_bytes import vcr from vcr.errors import CannotOverwriteExistingCassetteException +from ..assertions import assert_cassette_empty, assert_is_json_bytes + tornado = pytest.importorskip("tornado") http = pytest.importorskip("tornado.httpclient") diff --git a/tests/integration/test_urllib2.py b/tests/integration/test_urllib2.py index 2e50c3b..078c14a 100644 --- a/tests/integration/test_urllib2.py +++ b/tests/integration/test_urllib2.py @@ -5,12 +5,13 @@ from urllib.parse import urlencode from urllib.request import urlopen import pytest_httpbin.certs -from assertions import assert_cassette_has_one_response from pytest import mark # Internal imports import vcr +from ..assertions import assert_cassette_has_one_response + def urlopen_with_cafile(*args, **kwargs): context = ssl.create_default_context(cafile=pytest_httpbin.certs.where()) diff --git a/tests/integration/test_urllib3.py b/tests/integration/test_urllib3.py index fdaf620..d159ddb 100644 --- a/tests/integration/test_urllib3.py +++ b/tests/integration/test_urllib3.py @@ -4,12 +4,13 @@ import pytest import pytest_httpbin -from assertions import assert_cassette_empty, assert_is_json_bytes import vcr from vcr.patch import force_reset from vcr.stubs.compat import get_headers +from ..assertions import assert_cassette_empty, assert_is_json_bytes + urllib3 = pytest.importorskip("urllib3")