diff --git a/src/tests/test_cases/fstrings.py36 b/src/tests/test_cases/fstrings.py36 deleted file mode 100644 index 9d4243cb..00000000 --- a/src/tests/test_cases/fstrings.py36 +++ /dev/null @@ -1,11 +0,0 @@ -"""Test for warning about f-strings as docstrings.""" - -from .expected import Expectation - -expectation = Expectation() -expect = expectation.expect - - -@expect("D303: f-strings are not valid as docstrings") -def fstring(): - f"""Toggle the gizmo.""" diff --git a/src/tests/test_definitions.py b/src/tests/test_definitions.py index 4e9accb3..3971f0a0 100644 --- a/src/tests/test_definitions.py +++ b/src/tests/test_definitions.py @@ -1,8 +1,6 @@ """Old parser tests.""" -import sys import os -import os.path import re import pytest from pydocstyle.violations import Error, ErrorRegistry @@ -26,41 +24,17 @@ 'canonical_numpy_examples', 'canonical_pep257_examples', ]) -def test_all_interpreters(test_case): - """Complex test cases that run under all interpreters.""" - run_case(test_case) - - -@pytest.mark.skipif( - sys.version_info < (3, 6), - reason="f-string support needed" -) -def test_fstrings(): - """Run the f-string test case under Python 3.6+ only.""" - # When run under Python 3.5, mypy reports a parse error for the test file, - # because Python 3.5 doesn't support f-strings. It does not support - # ignoring parse errors. - # - # To work around this, we put our code in a file that mypy cannot see. This - # code reveals it to Python. - from . import test_cases - import importlib.machinery - test_cases_dir = test_cases.__path__[0] - loader = sys.path_importer_cache[test_cases_dir] - loader._loaders.append(('.py36', importlib.machinery.SourceFileLoader)) - - run_case('fstrings') - - -def run_case(test_case): +def test_complex_file(test_case): """Run domain-specific tests from test.py file.""" case_module = __import__(f'test_cases.{test_case}', globals=globals(), locals=locals(), fromlist=['expectation'], level=1) - - test_case_file = os.path.relpath(case_module.__file__) + test_case_dir = os.path.normcase(os.path.dirname(__file__)) + test_case_file = os.path.join(test_case_dir, + 'test_cases', + test_case + '.py') results = list(check([test_case_file], select=set(ErrorRegistry.get_error_codes()), ignore_decorators=re.compile(