Commits

Ronald Oussoren committed 1e427e3

Ensure test works when sources are bytecompiled

Comments (0)

Files changed (1)

modulegraph_tests/test_modulegraph.py

         # py3k issues without verifying that the code actually
         # works....
         graph = modulegraph.ModuleGraph()
-        graph.run_script(__file__)
+        if __file__.endswith('.py'):
+            graph.run_script(__file__)
+        else:
+            graph.run_script(__file__[:-1])
+
         graph.import_hook('os')
         graph.import_hook('xml.etree')
         graph.import_hook('unittest')
         # py3k issues without verifying that the code actually
         # works....
         graph = modulegraph.ModuleGraph()
-        graph.run_script(__file__)
+        if __file__.endswith('.py'):
+            graph.run_script(__file__)
+        else:
+            graph.run_script(__file__[:-1])
         graph.import_hook('os')
         graph.import_hook('xml.etree')
         graph.import_hook('unittest')