diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conftest.py | 2 | ||||
-rw-r--r-- | tests/goldtest.py | 8 | ||||
-rw-r--r-- | tests/test_concurrency.py | 14 | ||||
-rw-r--r-- | tests/test_parser.py | 2 | ||||
-rw-r--r-- | tests/test_phystokens.py | 2 | ||||
-rw-r--r-- | tests/test_process.py | 5 |
6 files changed, 8 insertions, 25 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index a2577086..5e3ed445 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -68,7 +68,7 @@ def set_warnings(): message=r".*find_spec\(\) not found; falling back to find_module\(\)", ) - if env.PYPY3: + if env.PYPY: # pypy3 warns about unclosed files a lot. warnings.filterwarnings("ignore", r".*unclosed file", category=ResourceWarning) diff --git a/tests/goldtest.py b/tests/goldtest.py index 7ea42754..57e3df66 100644 --- a/tests/goldtest.py +++ b/tests/goldtest.py @@ -22,10 +22,6 @@ def gold_path(path): return os.path.join(TESTS_DIR, "gold", path) -# "rU" was deprecated in 3.4 -READ_MODE = "rU" if env.PYVERSION < (3, 4) else "r" - - def versioned_directory(d): """Find a subdirectory of d specific to the Python version. For example, on Python 3.6.4 rc 1, it returns the first of these @@ -80,13 +76,13 @@ def compare( for f in diff_files: expected_file = os.path.join(expected_dir, f) - with open(expected_file, READ_MODE) as fobj: + with open(expected_file) as fobj: expected = fobj.read() if expected_file.endswith(".xml"): expected = canonicalize_xml(expected) actual_file = os.path.join(actual_dir, f) - with open(actual_file, READ_MODE) as fobj: + with open(actual_file) as fobj: actual = fobj.read() if actual_file.endswith(".xml"): actual = canonicalize_xml(actual) diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index a5aed4f1..e1606e83 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -374,12 +374,7 @@ class MultiprocessingTest(CoverageTest): source = . """ % concurrency) - if env.PYVERSION >= (3, 4): - start_methods = ['fork', 'spawn'] - else: - start_methods = [''] - - for start_method in start_methods: + for start_method in ["fork", "spawn"]: if start_method and start_method not in multiprocessing.get_all_start_methods(): continue @@ -441,12 +436,7 @@ class MultiprocessingTest(CoverageTest): omit = */site-packages/* """) - if env.PYVERSION >= (3, 4): - start_methods = ['fork', 'spawn'] - else: - start_methods = [''] - - for start_method in start_methods: + for start_method in ["fork", "spawn"]: if start_method and start_method not in multiprocessing.get_all_start_methods(): continue diff --git a/tests/test_parser.py b/tests/test_parser.py index 4a12c59c..46ee25f3 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -138,7 +138,7 @@ class PythonParserTest(CoverageTest): """) @pytest.mark.xfail( - env.PYPY3 and env.PYPYVERSION == (7, 3, 0), + env.PYPY and env.PYPYVERSION == (7, 3, 0), reason="https://bitbucket.org/pypy/pypy/issues/3139", ) def test_decorator_pragmas(self): diff --git a/tests/test_phystokens.py b/tests/test_phystokens.py index 06cdd385..82b887e6 100644 --- a/tests/test_phystokens.py +++ b/tests/test_phystokens.py @@ -130,7 +130,7 @@ class SourceEncodingTest(CoverageTest): assert source_encoding(source) == expected, "Wrong encoding in %r" % source # PyPy3 gets this case wrong. Not sure what I can do about it, so skip the test. - @pytest.mark.skipif(env.PYPY3, reason="PyPy3 is wrong about non-comment encoding. Skip it.") + @pytest.mark.skipif(env.PYPY, reason="PyPy3 is wrong about non-comment encoding. Skip it.") def test_detect_source_encoding_not_in_comment(self): # Should not detect anything here source = b'def parse(src, encoding=None):\n pass' diff --git a/tests/test_process.py b/tests/test_process.py index b57a4aa4..18774ef3 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -758,7 +758,7 @@ class ProcessTest(CoverageTest): # Pypy passes locally, but fails in CI? Perhaps the version of macOS is # significant? https://foss.heptapod.net/pypy/pypy/-/issues/3074 - @pytest.mark.skipif(env.PYPY3, reason="Pypy is unreliable with this test") + @pytest.mark.skipif(env.PYPY, reason="PyPy is unreliable with this test") # Jython as of 2.7.1rc3 won't compile a filename that isn't utf8. @pytest.mark.skipif(env.JYTHON, reason="Jython can't handle this test") def test_lang_c(self): @@ -871,9 +871,6 @@ class EnvironmentTest(CoverageTest): actual = self.run_command("coverage run -m process_test.try_execfile") self.assert_tryexecfile_output(expected, actual) - @pytest.mark.skipif(env.PYVERSION == (3, 5, 4, 'final', 0, 0), - reason="3.5.4 broke this: https://bugs.python.org/issue32551" - ) def test_coverage_run_dir_is_like_python_dir(self): with open(TRY_EXECFILE) as f: self.make_file("with_main/__main__.py", f.read()) |