Skip to content

Commit 8c4a9c6

Browse files
committed
Add initial os.system unit tests
1 parent e94f3f3 commit 8c4a9c6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/snippets/stdlib_os.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,18 @@ def __exit__(self, exc_type, exc_val, exc_tb):
313313
with os.scandir() as dir_iter:
314314
collected_files = [dir_entry.name for dir_entry in dir_iter]
315315
assert set(collected_files) == set(expected_files)
316+
317+
# system()
318+
if "win" not in sys.platform:
319+
assert os.system('ls') == 0
320+
assert os.system('{') != 0
321+
322+
for arg in [None, 1, 1.0, TabError]:
323+
try:
324+
os.system(arg)
325+
except TypeError:
326+
pass
327+
else:
328+
raise AssertionError(f'os.system failed to raise TypeError with arg {arg}')
329+
330+

0 commit comments

Comments
 (0)