Skip to content

Commit 14682fc

Browse files
authored
Enable test_stdconsole (#1060)
* Enable test_stdconsole * Increase timeout * Use temp folder * Disable on .NET Core * Remove FileUtil.temp_dir * Remove obsolete tests
1 parent cbfbac2 commit 14682fc

File tree

8 files changed

+90
-128
lines changed

8 files changed

+90
-128
lines changed

Src/IronPython/Hosting/PythonCommandLine.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ protected override void Initialize() {
148148
InitializeModules();
149149
InitializeExtensionDLLs();
150150

151+
// ensure the warnings module loads
152+
var warnOptions = PythonContext.GetSystemStateValue("warnoptions") as PythonList;
153+
if (warnOptions?.Count > 0) {
154+
PythonContext.GetWarningsModule();
155+
}
156+
151157
ImportSite();
152158

153159
// Equivalent to -i command line option

Src/IronPython/Lib/iptest/file_util.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,13 @@ def ensure_directory_present(self, path):
5151
def get_temp_dir(self):
5252
temp = self.get_environ_variable("TMP")
5353
if not temp: temp = self.get_environ_variable("TEMP")
54-
if (not temp or ' ' in temp) and os.name == 'nt':
54+
if (not temp or ' ' in temp) and os.name == 'nt':
5555
temp = r"C:\temp"
56-
if (not temp or ' ' in temp) and os.name == 'posix':
56+
if (not temp or ' ' in temp) and os.name == 'posix':
5757
temp = "/tmp"
5858

5959
return temp
6060

61-
temp_dir = property(get_temp_dir)
62-
6361
def delete_files(self, *files):
6462
for f in files:
6563
try: os.remove(f)

Src/IronPython/Lib/iptest/ipunittest.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ def load_ironpython_test(*args):
111111
class IronPythonTestCase(unittest.TestCase, FileUtil, ProcessUtil):
112112

113113
def setUp(self):
114+
temp_dir = self.get_temp_dir()
114115
if is_cli:
115-
self._temporary_dir = os.path.join(self.temp_dir, "IronPythonTest", clr.TargetFramework.translate(str.maketrans(" =,", "__-")))
116+
self._temporary_dir = os.path.join(temp_dir, "IronPythonTest", clr.TargetFramework.translate(str.maketrans(" =,", "__-")))
116117
else:
117-
self._temporary_dir = os.path.join(self.temp_dir, "IronPythonTest", "CPython")
118+
self._temporary_dir = os.path.join(temp_dir, "IronPythonTest", "CPython")
118119
self.ensure_directory_present(self._temporary_dir)
119120

120121
self._iron_python_test_dll = _iron_python_test_dll
@@ -164,21 +165,21 @@ def get_environ_variable(self, key):
164165
return None
165166

166167
# file paths
167-
def get_temporary_dir(self):
168+
@property
169+
def temporary_dir(self):
168170
return self._temporary_dir
169-
temporary_dir = property(get_temporary_dir)
170171

171-
def get_iron_python_test_dll(self):
172+
@property
173+
def iron_python_test_dll(self):
172174
return self._iron_python_test_dll
173-
iron_python_test_dll = property(get_iron_python_test_dll)
174175

175-
def get_test_dir(self):
176+
@property
177+
def test_dir(self):
176178
return self._test_dir
177-
test_dir = property(get_test_dir)
178179

179-
def get_test_inputs_dir(self):
180+
@property
181+
def test_inputs_dir(self):
180182
return self._test_inputs_dir
181-
test_inputs_dir = property(get_test_inputs_dir)
182183

183184
def run_test(name):
184185
if name == '__main__':

Src/IronPythonTest/Cases/IronPythonCasesManifest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Arguments=-X:CompilationThreshold 0 "$(TEST_FILE)" # ensure CompilationThreshold
9999
IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/489
100100

101101
[IronPython.test_stdconsole]
102-
Ignore=true
102+
Timeout=600000 # 10 minute timeout
103103

104104
[IronPython.test_superconsole]
105105
Ignore=true

Tests/interop/net/test_loadorder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
@skipUnlessIronPython()
9090
class LoadOrderTests(IronPythonTestCase, ProcessUtil):
9191
def test_all(self):
92-
directory = os.path.join(self.get_test_dir(), "interop", "net", "loadorder")
92+
directory = os.path.join(self.test_dir, "interop", "net", "loadorder")
9393

9494
count = 0
9595
for x in os.listdir(directory):

Tests/test_stdconsole.py

Lines changed: 69 additions & 112 deletions
Large diffs are not rendered by default.

Tests/vbproptest0.897451.dll

-6.5 KB
Binary file not shown.

Tests/vbproptest0.945595.dll

-7 KB
Binary file not shown.

0 commit comments

Comments
 (0)