fix initial __path__ setting test in Py3
authorStefan Behnel <stefan_ml@behnel.de>
Tue, 7 Aug 2012 13:25:52 +0000 (15:25 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Tue, 7 Aug 2012 13:25:52 +0000 (15:25 +0200)
runtests.py
tests/run/initial_file_path.srctree

index 0d85726..753cba9 100644 (file)
@@ -180,6 +180,7 @@ VER_DEP_MODULES = {
                                           'run.generator_frame_cycle', # yield in try-finally
                                           'run.relativeimport_T542',
                                           'run.relativeimport_star_T542',
+                                          'run.initial_file_path',  # relative import
                                           ]),
     (2,6) : (operator.lt, lambda x: x in ['run.print_function',
                                           'run.cython3',
index 27d7d1a..52c9c52 100644 (file)
@@ -17,11 +17,20 @@ setup(
 initial_path = __path__
 initial_file = __file__
 
-import a
+try:
+    from . import a
+    import_error = None
+except ImportError as e:
+    import_error = e
+    import traceback
+    traceback.print_exc()
 
 def test():
+    print "FILE: ", initial_file
+    print "PATH: ", initial_path
     assert initial_path[0].endswith('my_test_package'), initial_path
     assert initial_file.endswith('__init__.py'), initial_file
+    assert import_error is None, import_error
 
 ######## my_test_package/a.py ########