We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
test_popen
1 parent 2250ab6 commit fc07f86Copy full SHA for fc07f86
Lib/test/test_popen.py
@@ -57,14 +57,21 @@ def test_return_code(self):
57
def test_contextmanager(self):
58
with os.popen("echo hello") as f:
59
self.assertEqual(f.read(), "hello\n")
60
+ self.assertFalse(f.closed)
61
+ self.assertTrue(f.closed)
62
63
def test_iterating(self):
64
65
self.assertEqual(list(f), ["hello\n"])
66
67
68
69
def test_keywords(self):
- with os.popen(cmd="exit 0", mode="w", buffering=-1):
- pass
70
+ with os.popen(cmd="echo hello", mode="r", buffering=-1) as f:
71
+ self.assertEqual(f.read(), "hello\n")
72
73
74
+
75
76
if __name__ == "__main__":
77
unittest.main()
0 commit comments