diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-01-08 16:37:03 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-01-08 16:37:03 (GMT) |
commit | 472e7db5c0455b6d80326d75f619f7c0bfb3070f (patch) | |
tree | 6746a4be28a39bb527cac8b8568d6df8a528ecb1 | |
parent | b11ce9b96c724f9136d038847175a3a535417f56 (diff) | |
download | cpython-472e7db5c0455b6d80326d75f619f7c0bfb3070f.zip cpython-472e7db5c0455b6d80326d75f619f7c0bfb3070f.tar.gz cpython-472e7db5c0455b6d80326d75f619f7c0bfb3070f.tar.bz2 |
Various tweaks to make the test work on the Mac.
-rw-r--r-- | Lib/test/test_zipimport.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index 3c790eb..9bde605 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -15,7 +15,13 @@ import zipimport def make_pyc(co, mtime): data = marshal.dumps(co) - pyc = imp.get_magic() + struct.pack("<i", mtime) + data + if type(mtime) is type(0.0): + # Mac mtimes need a bit of special casing + if mtime < 0x7fffffff: + mtime = int(mtime) + else: + mtime = int(-0x100000000L + long(mtime)) + pyc = imp.get_magic() + struct.pack("<i", int(mtime)) + data return pyc NOW = time.time() @@ -32,7 +38,10 @@ TESTMOD = "ziptestmodule" TESTPACK = "ziptestpackage" TESTPACK2 = "ziptestpackage2" TEMP_ZIP = os.path.abspath("junk95142.zip") - +if sys.platform == 'mac': + CURDIRPREFIX=':' +else: + CURDIRPREFIX='' class UncompressedZipImportTestCase(ImportHooksBaseTestCase): @@ -59,7 +68,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase): if expected_ext: file = mod.get_file() self.assertEquals(file, os.path.join(TEMP_ZIP, - os.sep.join(modules) + expected_ext)) + CURDIRPREFIX + os.sep.join(modules) + expected_ext)) finally: z.close() os.remove(TEMP_ZIP) |