Skip to content

Commit 4e9e04a

Browse files
authored
Re-enable some tests (#1539)
* Re-enable test_print * Re-enable test_set * Re-enable test_array * Add missing file * Fix test failure * Re-enable test_support * Re-enable test_string_literals * Fix test failure * Mark as failing on macOS
1 parent dd24a8b commit 4e9e04a

13 files changed

Lines changed: 1541 additions & 34 deletions

File tree

Src/IronPython.Modules/array.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,7 @@ public array InPlaceMultiply(int value) {
196196
if (value <= 0) {
197197
_data.Clear();
198198
} else {
199-
var myData = __copy__();
200-
201-
for (int i = 0; i < (value - 1); i++) {
202-
ExtendArray(myData);
203-
}
199+
_data.InPlaceMultiply(value);
204200
}
205201
return this;
206202
}

Src/IronPython.Modules/nt.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ public static void mkdir([NotNone] string path, [ParamDictionary, NotNone] IDict
817817
}
818818
}
819819

820-
if (Directory.Exists(path)) throw DirectoryExists();
820+
if (Directory.Exists(path)) throw DirectoryExistsError(path);
821821
// we ignore mode
822822

823823
try {
@@ -2209,8 +2209,13 @@ private static bool TryGetShellCommand(string command, [NotNullWhen(true)] out s
22092209

22102210
#endif
22112211

2212-
private static Exception DirectoryExists() {
2213-
return PythonOps.OSError(PythonExceptions._OSError.ERROR_ALREADY_EXISTS, "directory already exists", null, PythonExceptions._OSError.ERROR_ALREADY_EXISTS);
2212+
private static Exception DirectoryExistsError(string? filename) {
2213+
#if FEATURE_NATIVE
2214+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
2215+
return GetWin32Error(PythonExceptions._OSError.ERROR_ALREADY_EXISTS, filename);
2216+
}
2217+
#endif
2218+
return GetOsError(PythonErrorNumber.EEXIST, filename);
22142219
}
22152220

22162221
#if FEATURE_NATIVE

Src/IronPython/Runtime/ArrayData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ internal interface ArrayData : IList {
2727
void InsertRange(int index, int count, ArrayData value);
2828
void RemoveSlice(Slice slice);
2929
ArrayData Multiply(int count);
30+
void InPlaceMultiply(int count);
3031
new bool Remove(object? item);
3132
void Reverse();
3233
Span<byte> AsByteSpan();

Src/IronPythonTest/Cases/CPythonCasesManifest.ini

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ Reason=ImportError: No module named audioop
114114
Ignore=true
115115
Reason=unittest.case.SkipTest: test irrelevant for an installed Python
116116

117-
[CPython.test_array]
118-
IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/489
117+
[CPython.test_array] # IronPython.test_array_stdlib
118+
Ignore=true
119119

120120
[CPython.test_ast]
121121
Ignore=true
@@ -756,6 +756,9 @@ Reason=unittest.case.SkipTest: No module named 'posix'
756756
[CPython.test_posixpath]
757757
Ignore=true
758758

759+
[CPython.test_print] # IronPython.test_print_stdlib
760+
Ignore=true
761+
759762
[CPython.test_profile]
760763
Ignore=true
761764

@@ -832,9 +835,8 @@ Ignore=true
832835
[CPython.test_selectors]
833836
Ignore=true
834837

835-
[CPython.test_set]
836-
RunCondition=NOT $(IS_MONO) # weakref failures; https://github.com/IronLanguages/ironpython3/issues/544
837-
IsolationLevel=PROCESS # Also weakref failures; https://github.com/IronLanguages/ironpython3/issues/489
838+
[CPython.test_set] # IronPython.test_set_stdlib
839+
Ignore=true
838840

839841
[CPython.test_shelve]
840842
NotParallelSafe=true
@@ -885,6 +887,9 @@ Ignore=true
885887
[CPython.test_strftime]
886888
Ignore=true
887889

890+
[CPython.test_string_literals] # IronPython.test_string_literals_stdlib
891+
Ignore=true
892+
888893
[CPython.test_stringprep]
889894
Ignore=true
890895
Reason=Requires unicode 3.2.0 data - https://github.com/IronLanguages/ironpython3/issues/691
@@ -924,8 +929,8 @@ Reason=ImportError: No module named _msi
924929
[CPython.test_super]
925930
Ignore=true
926931

927-
[CPython.test_support]
928-
RunCondition=NOT $(IS_POSIX) # TODO: debug
932+
[CPython.test_support] # IronPython.test_support_stdlib
933+
Ignore=true
929934

930935
[CPython.test_symtable]
931936
Ignore=true
@@ -1179,9 +1184,6 @@ Ignore=true # 2 failures
11791184
[CPython.test_abc]
11801185
Ignore=true # test_works_with_init_subclass - https://github.com/IronLanguages/ironpython3/issues/1448
11811186

1182-
[CPython.test_array]
1183-
Ignore=true # test_free_after_iterating/test_type_error
1184-
11851187
[CPython.test_asyncio.test_selector_events]
11861188
Ignore=true # blocking
11871189

@@ -1215,23 +1217,11 @@ Ignore=true # __annotations__
12151217
[CPython.test_ordered_dict]
12161218
Ignore=true # multiple failures
12171219

1218-
[CPython.test_print]
1219-
Ignore=true # 7 failures
1220-
12211220
[CPython.test_regrtest]
12221221
Ignore=true # lots of failures
12231222

1224-
[CPython.test_set]
1225-
Ignore=true # test_hash_effectiveness
1226-
12271223
[CPython.test_spwd]
12281224
Ignore=true # fails on macOS
12291225

1230-
[CPython.test_string_literals]
1231-
Ignore=true # AssertionError: DeprecationWarning not triggered
1232-
1233-
[CPython.test_support]
1234-
Ignore=true # lots of failures
1235-
12361226
[CPython.test_userlist]
12371227
Ignore=true # test_free_after_iterating

Src/IronPythonTest/Cases/IronPythonCasesManifest.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ WorkingDirectory=$(TEST_FILE_DIR)
44
Redirect=false
55
Timeout=120000 # 2 minute timeout
66

7+
[CPython.test_array_stdlib]
8+
IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/489
9+
710
[IronPython.test_builtin_stdlib]
811
RunCondition=NOT $(IS_MONO)
912
Reason=Exception on adding DocTestSuite
@@ -90,6 +93,10 @@ RetryCount=2
9093
IsolationLevel=PROCESS
9194
Arguments=-X:CompilationThreshold 0 "$(TEST_FILE)" # ensure CompilationThreshold is 0 otherwise tests are meaningless!
9295

96+
[IronPython.test_set_stdlib]
97+
RunCondition=NOT $(IS_MONO) # weakref failures; https://github.com/IronLanguages/ironpython3/issues/544
98+
IsolationLevel=PROCESS # Also weakref failures; https://github.com/IronLanguages/ironpython3/issues/489
99+
93100
[IronPython.test_socket_stdlib]
94101
RunCondition=NOT $(IS_MONO) # TODO: figure out
95102

Src/StdLib/Lib/test/test_array.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,6 @@ def test_bug_782369(self):
10391039
b = array.array('B', range(64))
10401040
self.assertEqual(rc, sys.getrefcount(10))
10411041

1042-
@unittest.skipIf(sys.implementation.name == "ironpython", "TODO: https://github.com/IronLanguages/ironpython3/issues/767")
10431042
def test_subclass_with_kwargs(self):
10441043
# SF bug #1486663 -- this used to erroneously raise a TypeError
10451044
ArraySubclassWithKwargs('b', newarg=1)
@@ -1368,7 +1367,6 @@ class DoubleTest(FPTest, unittest.TestCase):
13681367
typecode = 'd'
13691368
minitemsize = 8
13701369

1371-
@unittest.skipIf(sys.implementation.name == "ironpython", "TODO: https://github.com/IronLanguages/ironpython3/issues/767")
13721370
def test_alloc_overflow(self):
13731371
from sys import maxsize
13741372
a = array.array('d', [-1]*65536)

Src/StdLib/Lib/test/test_set.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ def test_cyclical_print(self):
333333
fo.close()
334334
support.unlink(support.TESTFN)
335335

336-
@unittest.skipIf(sys.implementation.name == "ironpython", "https://github.com/IronLanguages/ironpython3/issues/848")
337336
def test_do_not_rehash_dict_keys(self):
338337
n = 10
339338
d = dict.fromkeys(map(HashCountingInt, range(n)))

Src/StdLib/Lib/test/test_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def test_make_bad_fd(self):
270270
self.assertEqual(cm.exception.errno, errno.EBADF)
271271

272272
def test_check_syntax_error(self):
273-
support.check_syntax_error(self, "def class", lineno=1, offset=9)
273+
support.check_syntax_error(self, "def class", lineno=1, offset=5)
274274
with self.assertRaises(AssertionError):
275275
support.check_syntax_error(self, "x=1")
276276

0 commit comments

Comments
 (0)