File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import os
1717import time
1818import unittest
19+ import warnings
1920
2021import fs .copy
2122import fs .move
@@ -884,8 +885,9 @@ def test_open_files(self):
884885 self .assertFalse (f .closed )
885886 self .assertTrue (f .closed )
886887
887- iter_lines = iter (self .fs .open ("text" ))
888- self .assertEqual (next (iter_lines ), "Hello\n " )
888+ with self .fs .open ("text" ) as f :
889+ iter_lines = iter (f )
890+ self .assertEqual (next (iter_lines ), "Hello\n " )
889891
890892 with self .fs .open ("unicode" , "w" ) as f :
891893 self .assertEqual (12 , f .write ("Héllo\n Wörld\n " ))
@@ -1594,8 +1596,10 @@ def test_files(self):
15941596 self .assert_bytes ("foo2" , b"help" )
15951597
15961598 # Test __del__ doesn't throw traceback
1597- f = self .fs .open ("foo2" , "r" )
1598- del f
1599+ with warnings .catch_warnings ():
1600+ warnings .simplefilter ("ignore" )
1601+ f = self .fs .open ("foo2" , "r" )
1602+ del f
15991603
16001604 with self .assertRaises (IOError ):
16011605 with self .fs .open ("foo2" , "r" ) as f :
You can’t perform that action at this time.
0 commit comments