From: Daniele Varrazzo Date: Mon, 8 Nov 2021 19:38:47 +0000 (+0100) Subject: Allow to run typing tests from an arbitrary location X-Git-Tag: 3.0.3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb987ee45d0f1ee117a397cb7344859f87708a52;p=thirdparty%2Fpsycopg.git Allow to run typing tests from an arbitrary location --- diff --git a/tests/test_typing.py b/tests/test_typing.py index f8c56c96f..97e79577f 100644 --- a/tests/test_typing.py +++ b/tests/test_typing.py @@ -1,14 +1,17 @@ +import os import sys import pytest +HERE = os.path.dirname(os.path.abspath(__file__)) + @pytest.mark.parametrize( "filename", [ - "tests/adapters_example.py", + "adapters_example.py", pytest.param( - "tests/typing_example.py", + "typing_example.py", marks=pytest.mark.skipif( sys.version_info < (3, 7), reason="no future annotations" ), @@ -16,7 +19,7 @@ import pytest ], ) def test_typing_example(mypy, filename): - cp = mypy.run_on_file(filename) + cp = mypy.run_on_file(os.path.join(HERE, filename)) errors = cp.stdout.decode("utf8", "replace").splitlines() assert not errors assert cp.returncode == 0