diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_filereporter.py | 2 | ||||
-rw-r--r-- | tests/test_python.py | 22 |
2 files changed, 14 insertions, 10 deletions
diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py index 8ce2201d..1e8513f8 100644 --- a/tests/test_filereporter.py +++ b/tests/test_filereporter.py @@ -89,7 +89,7 @@ class FileReporterTest(UsingModulesMixin, CoverageTest): assert bcu > acu and bcu >= acu and bcu != acu def test_zipfile(self): - sys.path.append("tests/zipmods.zip") + sys.path.append("tests/zip1.zip") # Test that we can get files out of zipfiles, and read their source files. # The zip1 module is installed by an action in igor.py. diff --git a/tests/test_python.py b/tests/test_python.py index 0175f5af..dc9609c9 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -19,18 +19,22 @@ class GetZipBytesTest(CoverageTest): run_in_temp_dir = False - def test_get_encoded_zip_files(self): + @pytest.mark.parametrize( + "encoding", + ["utf8", "gb2312", "hebrew", "shift_jis", "cp1252"], + ) + def test_get_encoded_zip_files(self, encoding): # See igor.py, do_zipmods, for the text of these files. zip_file = "tests/zipmods.zip" sys.path.append(zip_file) # So we can import the files. - for encoding in ["utf8", "gb2312", "hebrew", "shift_jis", "cp1252"]: - filename = zip_file + "/encoded_" + encoding + ".py" - filename = filename.replace("/", os.sep) - zip_data = get_zip_bytes(filename) - zip_text = zip_data.decode(encoding) - assert 'All OK' in zip_text - # Run the code to see that we really got it encoded properly. - __import__("encoded_"+encoding) + filename = zip_file + "/encoded_" + encoding + ".py" + filename = filename.replace("/", os.sep) + zip_data = get_zip_bytes(filename) + zip_text = zip_data.decode(encoding) + assert 'All OK' in zip_text + # Run the code to see that we really got it encoded properly. + mod = __import__("encoded_"+encoding) + assert mod.encoding == encoding def test_source_for_file(tmpdir): |