File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,21 @@ def test_return_code(self):
57
57
def test_contextmanager (self ):
58
58
with os .popen ("echo hello" ) as f :
59
59
self .assertEqual (f .read (), "hello\n " )
60
+ self .assertFalse (f .closed )
61
+ self .assertTrue (f .closed )
60
62
61
63
def test_iterating (self ):
62
64
with os .popen ("echo hello" ) as f :
63
65
self .assertEqual (list (f ), ["hello\n " ])
66
+ self .assertFalse (f .closed )
67
+ self .assertTrue (f .closed )
64
68
65
69
def test_keywords (self ):
66
- with os .popen (cmd = "exit 0" , mode = "w" , buffering = - 1 ):
67
- pass
70
+ with os .popen (cmd = "echo hello" , mode = "r" , buffering = - 1 ) as f :
71
+ self .assertEqual (f .read (), "hello\n " )
72
+ self .assertFalse (f .closed )
73
+ self .assertTrue (f .closed )
74
+
68
75
69
76
if __name__ == "__main__" :
70
77
unittest .main ()
You can’t perform that action at this time.
0 commit comments