diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-12-27 10:01:32 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-12-27 10:01:32 -0500 |
commit | abd2ae644d0009cc469e86492216ff311e543116 (patch) | |
tree | 60e090f61f96f7dc9bc02082c41de638aaa495b7 | |
parent | 6d8689383231ca74b6e2c181c1f196c965db1138 (diff) | |
download | python-coveragepy-git-abd2ae644d0009cc469e86492216ff311e543116.tar.gz |
Two windows fixes for tests
-rw-r--r-- | tests/test_files.py | 1 | ||||
-rw-r--r-- | tests/try_execfile.py | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_files.py b/tests/test_files.py index 62d3e320..d7b8bd47 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -262,6 +262,7 @@ class GetZipBytesTest(CoverageTest): 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) diff --git a/tests/try_execfile.py b/tests/try_execfile.py index ee5bae5c..e0b79b48 100644 --- a/tests/try_execfile.py +++ b/tests/try_execfile.py @@ -32,7 +32,12 @@ def same_file(p1, p2): return False if not os.path.exists(p2): return False - return os.path.samefile(p1, p2) + if hasattr(os.path, "samefile"): + return os.path.samefile(p1, p2) + else: + norm1 = os.path.normcase(os.path.normpath(p1)) + norm2 = os.path.normcase(os.path.normpath(p2)) + return norm1 == norm2 def without_same_files(filenames): """Return the list `filenames` with duplicates (by same_file) removed.""" |