Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 52e1e10

Browse files
committed
Remove py3.5 compat from tests
1 parent 7146353 commit 52e1e10

File tree

2 files changed

+5
-42
lines changed

2 files changed

+5
-42
lines changed

src/tests/test_cases/fstrings.py36

-11
This file was deleted.

src/tests/test_definitions.py

+5-31
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""Old parser tests."""
22

3-
import sys
43
import os
5-
import os.path
64
import re
75
import pytest
86
from pydocstyle.violations import Error, ErrorRegistry
@@ -26,41 +24,17 @@
2624
'canonical_numpy_examples',
2725
'canonical_pep257_examples',
2826
])
29-
def test_all_interpreters(test_case):
30-
"""Complex test cases that run under all interpreters."""
31-
run_case(test_case)
32-
33-
34-
@pytest.mark.skipif(
35-
sys.version_info < (3, 6),
36-
reason="f-string support needed"
37-
)
38-
def test_fstrings():
39-
"""Run the f-string test case under Python 3.6+ only."""
40-
# When run under Python 3.5, mypy reports a parse error for the test file,
41-
# because Python 3.5 doesn't support f-strings. It does not support
42-
# ignoring parse errors.
43-
#
44-
# To work around this, we put our code in a file that mypy cannot see. This
45-
# code reveals it to Python.
46-
from . import test_cases
47-
import importlib.machinery
48-
test_cases_dir = test_cases.__path__[0]
49-
loader = sys.path_importer_cache[test_cases_dir]
50-
loader._loaders.append(('.py36', importlib.machinery.SourceFileLoader))
51-
52-
run_case('fstrings')
53-
54-
55-
def run_case(test_case):
27+
def test_complex_file(test_case):
5628
"""Run domain-specific tests from test.py file."""
5729
case_module = __import__(f'test_cases.{test_case}',
5830
globals=globals(),
5931
locals=locals(),
6032
fromlist=['expectation'],
6133
level=1)
62-
63-
test_case_file = os.path.relpath(case_module.__file__)
34+
test_case_dir = os.path.normcase(os.path.dirname(__file__))
35+
test_case_file = os.path.join(test_case_dir,
36+
'test_cases',
37+
test_case + '.py')
6438
results = list(check([test_case_file],
6539
select=set(ErrorRegistry.get_error_codes()),
6640
ignore_decorators=re.compile(

0 commit comments

Comments
 (0)