Skip to content

Commit 3c429f1

Browse files
committed
Handle failing tests
1 parent 36bcbd7 commit 3c429f1

File tree

7 files changed

+96
-11
lines changed

7 files changed

+96
-11
lines changed

Src/IronPythonTest/Cases/CPythonCasesManifest.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,11 @@ RunCondition=NOT $(IS_POSIX) # TODO: figure out
476476
RunCondition=$(IS_POSIX)
477477
Reason=Only valid for Unix
478478

479+
[CPython.test_hash] # IronPython.test_hash_stdlib
480+
Ignore=true
481+
479482
[CPython.test_httplib] # IronPython.test_httplib_stdlib
480483
Ignore=true
481-
Reason=Blocking
482484

483485
[CPython.test_httpservers]
484486
Ignore=true
@@ -496,7 +498,6 @@ Reason=Blocking
496498
RunCondition=NOT $(IS_LINUX) # TODO: debug
497499
NotParallelSafe=true # Creates/deletes a module with a static name 'test_imp_helper'
498500

499-
500501
[CPython.test_import]
501502
Ignore=true
502503
Reason=ImportError: No module named _multiprocessing

Src/StdLib/Lib/test/test_hash.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def test_hashes(self):
166166
for obj in self.hashes_to_check:
167167
self.assertEqual(hash(obj), _default_hash(obj))
168168

169-
@unittest.skipIf(sys.implementation.name == "ironpython", "TODO")
170169
class HashRandomizationTests:
171170

172171
# Each subclass should define a field "repr_", containing the repr() of

Tests/test_formatting.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import math
66
import os
77

8-
from iptest import IronPythonTestCase, is_cli, is_netcoreapp, is_netcoreapp21, big, run_test, skipUnlessIronPython
8+
from iptest import IronPythonTestCase, is_cli, is_cli32, is_netcoreapp, is_netcoreapp21, big, run_test, skipUnlessIronPython
99

1010
class A:
1111
def __str__(self):
@@ -407,6 +407,13 @@ def test_format_testfile(self):
407407
%r 0.999999999999e-4 -> 9.99999999999e-05
408408
%r 0.999e-4 -> 9.99e-05
409409
%r 1e-5 -> 1e-05
410+
""".strip().split("\n")
411+
412+
if is_cli32:
413+
expected_failures += """
414+
%r 1.0000000000000001e-4 -> 0.0001
415+
%r 1e-4 -> 0.0001
416+
%r 0.99999999999999999e-4 -> 0.0001
410417
""".strip().split("\n")
411418

412419
if not format_rounds_to_even:

Tests/test_hash_stdlib.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Licensed to the .NET Foundation under one or more agreements.
2+
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
3+
# See the LICENSE file in the project root for more information.
4+
5+
##
6+
## Run selected tests from test_hash from StdLib
7+
##
8+
9+
from iptest import is_ironpython, is_netcoreapp, is_cli32, generate_suite, run_test
10+
11+
import test.test_hash
12+
13+
def load_tests(loader, standard_tests, pattern):
14+
tests = loader.loadTestsFromModule(test.test_hash)
15+
16+
if is_ironpython:
17+
test.test_hash.BytesHashRandomizationTests('test_empty_string')
18+
test.test_hash.BytesHashRandomizationTests('test_fixed_hash')
19+
test.test_hash.BytesHashRandomizationTests('test_long_fixed_hash')
20+
test.test_hash.HashBuiltinsTestCase('test_hashes')
21+
test.test_hash.HashEqualityTestCase('test_coerced_floats')
22+
test.test_hash.HashEqualityTestCase('test_coerced_integers')
23+
test.test_hash.HashEqualityTestCase('test_numeric_literals')
24+
test.test_hash.HashEqualityTestCase('test_unaligned_buffers')
25+
test.test_hash.HashInheritanceTestCase('test_default_hash')
26+
test.test_hash.HashInheritanceTestCase('test_error_hash')
27+
test.test_hash.HashInheritanceTestCase('test_fixed_hash')
28+
test.test_hash.HashInheritanceTestCase('test_hashable')
29+
test.test_hash.HashInheritanceTestCase('test_not_hashable')
30+
test.test_hash.MemoryviewHashRandomizationTests('test_empty_string')
31+
test.test_hash.MemoryviewHashRandomizationTests('test_fixed_hash')
32+
test.test_hash.MemoryviewHashRandomizationTests('test_long_fixed_hash')
33+
test.test_hash.StrHashRandomizationTests('test_empty_string')
34+
test.test_hash.StrHashRandomizationTests('test_fixed_hash')
35+
test.test_hash.StrHashRandomizationTests('test_long_fixed_hash')
36+
test.test_hash.StrHashRandomizationTests('test_ucs2_string')
37+
38+
failing_tests = [
39+
test.test_hash.BytesHashRandomizationTests('test_null_hash'), # KeyError: dotnet
40+
test.test_hash.MemoryviewHashRandomizationTests('test_null_hash'), # KeyError: dotnet
41+
test.test_hash.StrHashRandomizationTests('test_null_hash'), # KeyError: dotnet
42+
test.test_hash.DatetimeDateTests('test_randomized_hash'),
43+
test.test_hash.DatetimeDatetimeTests('test_randomized_hash'),
44+
test.test_hash.DatetimeTimeTests('test_randomized_hash'),
45+
]
46+
47+
if not is_netcoreapp:
48+
failing_tests += [
49+
test.test_hash.BytesHashRandomizationTests('test_randomized_hash'),
50+
test.test_hash.MemoryviewHashRandomizationTests('test_randomized_hash'),
51+
test.test_hash.StrHashRandomizationTests('test_randomized_hash'),
52+
]
53+
54+
if is_cli32:
55+
failing_tests += [
56+
test.test_hash.HashDistributionTestCase('test_hash_distribution'),
57+
]
58+
59+
skip_tests = []
60+
61+
return generate_suite(tests, failing_tests, skip_tests)
62+
63+
else:
64+
return tests
65+
66+
run_test(__name__)

Tests/test_memoryview.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,16 @@ def test_equality_structural(self):
205205
self.assertFalse(mv_d == mv_f)
206206

207207
mv_P = mv.cast('P')
208-
self.assertFalse(mv_P == mv_i)
209-
self.assertFalse(mv_P == mv_L)
210-
self.assertTrue(mv_P == mv_q)
211-
self.assertTrue(mv_P == mv_Q)
208+
if is_64:
209+
self.assertFalse(mv_P == mv_i)
210+
self.assertFalse(mv_P == mv_L)
211+
self.assertTrue(mv_P == mv_q)
212+
self.assertTrue(mv_P == mv_Q)
213+
else:
214+
self.assertTrue(mv_P == mv_i)
215+
self.assertTrue(mv_P == mv_L)
216+
self.assertFalse(mv_P == mv_q)
217+
self.assertFalse(mv_P == mv_Q)
212218

213219
# Comparing different formats works if the values are the same
214220
b = bytes(range(8))

Tests/test_stdconsole.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88
import unittest
99

10-
from iptest import IronPythonTestCase, is_cli, is_netcoreapp21, is_posix, run_test, skipUnlessIronPython
10+
from iptest import IronPythonTestCase, is_cli, is_cli32, is_netcoreapp21, is_posix, run_test, skipUnlessIronPython
1111

1212
if is_cli:
1313
import clr
@@ -82,6 +82,8 @@ def TestCommandLine(self, args, expected_output, expected_exitcode = 0):
8282
realargs.extend(args)
8383
exitcode = os.spawnv(0, self.batfile, realargs)
8484
cmdline = "ipy " + ' '.join(args)
85+
if is_cli32:
86+
cmdline = "ipy32 " + ' '.join(args)
8587

8688
print('')
8789
print(' {}'.format(cmdline))

Tests/test_struct_stdlib.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## Run selected tests from test_struct from StdLib
77
##
88

9-
from iptest import is_ironpython, generate_suite, run_test
9+
from iptest import is_ironpython, is_64, generate_suite, run_test
1010

1111
import test.test_struct
1212

@@ -17,12 +17,16 @@ def load_tests(loader, standard_tests, pattern):
1717
failing_tests = [
1818
test.test_struct.StructTest('test_705836'), # TODO: figure out
1919
test.test_struct.StructTest('test_bool'), # TODO: figure out
20-
test.test_struct.StructTest('test_calcsize'), # TODO: figure out
2120
test.test_struct.StructTest('test_count_overflow'), # TODO: figure out
2221
test.test_struct.StructTest('test_trailing_counter'), # TODO: figure out
2322
test.test_struct.UnpackIteratorTest('test_construct'), # TODO: figure out
2423
]
2524

25+
if is_64:
26+
failing_tests += [
27+
test.test_struct.StructTest('test_calcsize'), # https://github.com/IronLanguages/ironpython3/pull/869
28+
]
29+
2630
return generate_suite(tests, failing_tests)
2731

2832
else:

0 commit comments

Comments
 (0)