Commit 295e0233 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Make the import tests slightly more robust

I guess in CPython, __file__ will be the path to the pyc if that's how
the library was loaded.  (We don't do that but that difference isn't the
issue here.)  So that makes these tests, which print __file__, sensitive
to whether the last run of the test was through cpython (pyc exists and
__file__ ends in pyc) or through pyston (pyc exists but was wasn't valid
for cpython, and __file__ ends in py)

Just do some canonicalization when printing
parent 911ed1f5
import os
import test_package
print 1, test_package.__name__, os.path.normpath(test_package.__file__)
print 1, test_package.__name__, os.path.normpath(test_package.__file__).replace(".pyc", ".py")
import test_package.intrapackage_import
import test_package.absolute_import
......
import os
import import_target
print 3, import_target.__name__, os.path.normpath(import_target.__file__)
print 3, import_target.__name__, os.path.normpath(import_target.__file__).replace(".pyc", ".py")
......@@ -2,4 +2,4 @@ from __future__ import absolute_import
import os
import import_target
print 4, import_target.__name__, os.path.normpath(import_target.__file__)
print 4, import_target.__name__, os.path.normpath(import_target.__file__).replace(".pyc", ".py")
import os
from . import import_target
print 2, import_target.__name__, os.path.normpath(import_target.__file__)
print 2, import_target.__name__, os.path.normpath(import_target.__file__).replace(".pyc", ".py")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment