Skip to content

Commit 8aaa27b

Browse files
authored
Update test_open_abplus (#1851)
* Update test_open_abplus * Skip test_dict.DictTest.test_container_iterator on Mono
1 parent 819bccb commit 8aaa27b

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

Tests/modules/system_related/test_os.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,20 @@ def test_strerror(self):
3737
elif is_osx:
3838
self.assertEqual(os.strerror(40), "Message too long")
3939

40+
4041
def test_open_abplus(self):
4142
# equivalent to open(self.temp_file, "ab+"), see also test_file.test_open_abplus
4243
fd = os.open(self.temp_file, os.O_APPEND | os.O_CREAT | os.O_RDWR)
4344
try:
4445
f = open(fd, mode="ab+", closefd=False)
45-
f.write(b"abc")
46-
f.seek(0)
47-
self.assertEqual(f.read(2), b"ab")
48-
f.write(b"def")
49-
self.assertEqual(f.read(2), b"")
50-
f.seek(0)
51-
self.assertEqual(f.read(6), b"abcdef")
46+
f.raw.write(b"abcxxxx")
47+
f.raw.seek(0)
48+
self.assertEqual(f.raw.read(2), b"ab")
49+
f.raw.seek(0, 2)
50+
f.raw.write(b"def")
51+
self.assertEqual(f.raw.read(2), b"")
52+
f.raw.seek(0)
53+
self.assertEqual(f.raw.read(), b"abcxxxxdef")
5254
f.close()
5355
finally:
5456
os.close(fd)

Tests/test_dict_stdlib.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ def load_tests(loader, standard_tests, pattern):
2323
test.test_dict.DictTest('test_oob_indexing_dictiter_iternextitem'),
2424
test.test_dict.DictTest('test_setdefault_atomic'),
2525
]
26+
27+
skip_tests = []
2628
if is_mono:
27-
failing_tests += [
29+
skip_tests += [
2830
test.test_dict.DictTest('test_container_iterator'), # https://github.com/IronLanguages/ironpython3/issues/544
2931
]
3032

31-
return generate_suite(tests, failing_tests)
33+
return generate_suite(tests, failing_tests, skip_tests)
3234

3335
else:
3436
return tests

Tests/test_file.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -845,14 +845,15 @@ def test_open_wbplus(self):
845845
f.seek(0)
846846
self.assertEqual(f.read(), b"abdez")
847847

848+
848849
def test_open_abplus(self):
849850
with open(self.temp_file, "ab+") as f:
850-
f.write(b"abc")
851-
f.seek(0)
852-
self.assertEqual(f.read(2), b"ab")
853-
f.write(b"def")
854-
self.assertEqual(f.read(2), b"")
855-
f.seek(0)
856-
self.assertEqual(f.read(6), b"abcdef")
851+
f.raw.write(b"abc")
852+
f.raw.seek(0)
853+
self.assertEqual(f.raw.read(2), b"ab")
854+
f.raw.write(b"def")
855+
self.assertEqual(f.raw.read(2), b"")
856+
f.raw.seek(0)
857+
self.assertEqual(f.raw.read(6), b"abcdef")
857858

858859
run_test(__name__)

0 commit comments

Comments
 (0)