Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 26757ab

Browse files
authored
TST: don't run tests in py2 mode (#69)
Since NumPy officially doesn't support Python 2 anymore, there doesn't seem to be any particular need to test for it. Note that this doesn't actually do anything to make the stubs not Python 2 friendly as `.pyi` syntax has always been 2/3 compatible.
1 parent 773130b commit 26757ab

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

tests/test_stubs.py

+18-28
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,30 @@
1212

1313

1414
def get_test_cases(directory):
15-
for root, __, files in os.walk(directory):
15+
for root, _, files in os.walk(directory):
1616
for fname in files:
1717
if os.path.splitext(fname)[-1] == ".py":
1818
fullpath = os.path.join(root, fname)
1919
# Use relative path for nice py.test name
2020
relpath = os.path.relpath(fullpath, start=directory)
21-
skip_py2 = fname.endswith("_py3.py")
22-
skip_py3 = fname.endswith("_py2.py")
23-
24-
for py_version_number in (2, 3):
25-
if py_version_number == 2 and skip_py2:
26-
continue
27-
if py_version_number == 3 and skip_py3:
28-
continue
29-
py2_arg = ["--py2"] if py_version_number == 2 else []
30-
31-
yield pytest.param(
32-
fullpath,
33-
py2_arg,
34-
# Manually specify a name for the test
35-
id="{} - python{}".format(relpath, py_version_number),
36-
)
37-
38-
39-
@pytest.mark.parametrize("path,py2_arg", get_test_cases(PASS_DIR))
40-
def test_success(path, py2_arg):
41-
stdout, stderr, exitcode = api.run([path] + py2_arg)
21+
22+
yield pytest.param(
23+
fullpath,
24+
# Manually specify a name for the test
25+
id=relpath,
26+
)
27+
28+
29+
@pytest.mark.parametrize("path", get_test_cases(PASS_DIR))
30+
def test_success(path):
31+
stdout, stderr, exitcode = api.run([path])
4232
assert exitcode == 0, stdout
4333
assert re.match(r"Success: no issues found in \d+ source files?", stdout.strip())
4434

4535

46-
@pytest.mark.parametrize("path,py2_arg", get_test_cases(FAIL_DIR))
47-
def test_fail(path, py2_arg):
48-
stdout, stderr, exitcode = api.run([path] + py2_arg)
36+
@pytest.mark.parametrize("path", get_test_cases(FAIL_DIR))
37+
def test_fail(path):
38+
stdout, stderr, exitcode = api.run([path])
4939

5040
assert exitcode != 0
5141

@@ -80,9 +70,9 @@ def test_fail(path, py2_arg):
8070
pytest.fail(f"Error {repr(errors[lineno])} not found")
8171

8272

83-
@pytest.mark.parametrize("path,py2_arg", get_test_cases(REVEAL_DIR))
84-
def test_reveal(path, py2_arg):
85-
stdout, stderr, exitcode = api.run([path] + py2_arg)
73+
@pytest.mark.parametrize("path", get_test_cases(REVEAL_DIR))
74+
def test_reveal(path):
75+
stdout, stderr, exitcode = api.run([path])
8676

8777
with open(path) as fin:
8878
lines = fin.readlines()

0 commit comments

Comments
 (0)