diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_codeunit.py | 3 | ||||
-rw-r--r-- | tests/test_files.py | 22 | ||||
-rw-r--r-- | tests/test_python.py | 27 |
3 files changed, 30 insertions, 22 deletions
diff --git a/tests/test_codeunit.py b/tests/test_codeunit.py index c8389870..54e525b9 100644 --- a/tests/test_codeunit.py +++ b/tests/test_codeunit.py @@ -3,7 +3,8 @@ import os import sys -from coverage.codeunit import CodeUnit, PythonCodeUnit +from coverage.codeunit import CodeUnit +from coverage.python import PythonCodeUnit from tests.coveragetest import CoverageTest diff --git a/tests/test_files.py b/tests/test_files.py index d7b8bd47..ae56e728 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -2,11 +2,10 @@ import os import os.path -import sys from coverage.files import ( FileLocator, TreeMatcher, FnmatchMatcher, ModuleMatcher, PathAliases, - find_python_files, abs_file, get_zip_bytes + find_python_files, abs_file ) from coverage.misc import CoverageException @@ -249,22 +248,3 @@ class FindPythonFilesTest(CoverageTest): "sub/ssub/__init__.py", "sub/ssub/s.py", "sub/windows.pyw", ]) - - -class GetZipBytesTest(CoverageTest): - """Tests of `get_zip_bytes`.""" - - run_in_temp_dir = False - - def test_get_encoded_zip_files(self): - # 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"]: - filename = zip_file + "/encoded_" + encoding + ".py" - filename = filename.replace("/", os.sep) - zip_data = get_zip_bytes(filename) - zip_text = zip_data.decode(encoding) - self.assertIn('All OK', zip_text) - # Run the code to see that we really got it encoded properly. - __import__("encoded_"+encoding) diff --git a/tests/test_python.py b/tests/test_python.py new file mode 100644 index 00000000..f2c18a10 --- /dev/null +++ b/tests/test_python.py @@ -0,0 +1,27 @@ +"""Tests of coverage/python.py""" + +import os +import sys + +from coverage.python import get_zip_bytes + +from tests.coveragetest import CoverageTest + + +class GetZipBytesTest(CoverageTest): + """Tests of `get_zip_bytes`.""" + + run_in_temp_dir = False + + def test_get_encoded_zip_files(self): + # 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"]: + filename = zip_file + "/encoded_" + encoding + ".py" + filename = filename.replace("/", os.sep) + zip_data = get_zip_bytes(filename) + zip_text = zip_data.decode(encoding) + self.assertIn('All OK', zip_text) + # Run the code to see that we really got it encoded properly. + __import__("encoded_"+encoding) |