Skip to content

Commit b81d291

Browse files
committed
pythongh-131234: Improve test_popen with more asserts
1 parent 9649278 commit b81d291

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_popen.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ def test_return_code(self):
5757
def test_contextmanager(self):
5858
with os.popen("echo hello") as f:
5959
self.assertEqual(f.read(), "hello\n")
60+
self.assertFalse(f.closed)
6061

6162
def test_iterating(self):
6263
with os.popen("echo hello") as f:
6364
self.assertEqual(list(f), ["hello\n"])
65+
self.assertFalse(f.closed)
6466

6567
def test_keywords(self):
66-
with os.popen(cmd="exit 0", mode="w", buffering=-1):
67-
pass
68+
with os.popen(cmd="echo hello", mode="r", buffering=-1) as f:
69+
self.assertEqual(f.read(), "hello\n")
70+
self.assertFalse(f.closed)
6871

6972
if __name__ == "__main__":
7073
unittest.main()

0 commit comments

Comments
 (0)