Skip to content

Commit a92e9ac

Browse files
authored
Enable test_compiler (#1059)
* Enable test_compiler * Set IsolationLevel
1 parent 507eb33 commit a92e9ac

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

Src/IronPython/Runtime/PythonContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2890,7 +2890,7 @@ internal CompiledLoader GetCompiledLoader() {
28902890
SystemState.__dict__["meta_path"] = lstPath = new PythonList();
28912891
}
28922892

2893-
lstPath.append(_compiledLoader);
2893+
lstPath.insert(0, _compiledLoader);
28942894
}
28952895
}
28962896

Src/IronPythonTest/Cases/IronPythonCasesManifest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ IsolationLevel=PROCESS # TODO: figure out - wpf fails to load otherwise
1818
IsolationLevel=PROCESS # requires System.Drawing assembly to be unloaded
1919

2020
[IronPython.test_compiler]
21-
Ignore=true
21+
IsolationLevel=PROCESS # TODO: figure out - breaks the sys module in other tests
2222

2323
[IronPython.test_dllsite]
2424
Ignore=true

Tests/test_compiler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_package_init(self):
112112
self.assertEqual(initPackage.f(), 42)
113113

114114
def test_package_simple(self):
115-
self.compilePackage("simplePackage", { "__init__.py" : "import a\nimport b\ndef f(): return a.f() + b.f()",
115+
self.compilePackage("simplePackage", { "__init__.py" : "from . import a\nfrom . import b\ndef f(): return a.f() + b.f()",
116116
"a.py" : "def f() : return 10",
117117
"b.py" : "def f() : return 20"})
118118

@@ -122,7 +122,7 @@ def test_package_simple(self):
122122
self.assertEqual(simplePackage.b.f(), 20)
123123

124124
def test_package_subpackage(self):
125-
self.compilePackage("subPackage", { "__init__.py" : "import a\nimport b.c\ndef f(): return a.f() + b.c.f()",
125+
self.compilePackage("subPackage", { "__init__.py" : "from . import a\nfrom .b import c\ndef f(): return a.f() + c.f()",
126126
"a.py" : "def f(): return 10",
127127
"b/__init__.py" : "def f(): return 'kthxbye'",
128128
"b/c.py" : "def f(): return 20"})
@@ -133,8 +133,8 @@ def test_package_subpackage(self):
133133
self.assertEqual(subPackage.b.c.f(), 20)
134134

135135
def test_package_subpackage_relative_imports(self):
136-
self.compilePackage("subPackage_relative", { "__init__.py" : "from foo import bar",
137-
"foo/__init__.py" : "from foo import bar",
136+
self.compilePackage("subPackage_relative", { "__init__.py" : "from .foo import bar",
137+
"foo/__init__.py" : "from .foo import bar",
138138
"foo/foo.py" : "bar = 'BAR'"})
139139

140140
import subPackage_relative
@@ -181,7 +181,7 @@ def test_cyclic_modules(self):
181181
self.assertEqual(cyclic_modules1.cyclic_modules.A, 0)
182182

183183
def test_cyclic_pkg(self):
184-
self.compilePackage("cyclic_package", { "__init__.py" : "import cyclic_submodules0\nimport cyclic_submodules1",
184+
self.compilePackage("cyclic_package", { "__init__.py" : "from . import cyclic_submodules0\nfrom . import cyclic_submodules1",
185185
"cyclic_submodules0.py" : "import cyclic_package.cyclic_submodules1\nA = 2",
186186
"cyclic_submodules1.py" : "import cyclic_package.cyclic_submodules0\nA = 3"})
187187

0 commit comments

Comments
 (0)