<s> '''<STR_LIT>''' <EOL> import os <EOL> import time <EOL> from six . moves . urllib . request import urlopen <EOL> import vcr <EOL> def test_disk_saver_nowrite ( tmpdir ) : <EOL> '''<STR_LIT>''' <EOL> fname = str ( tmpdir . join ( '<STR_LIT>' ) ) <EOL> with vcr . use_cassette ( fname ) as cass : <EOL> urlopen ( '<STR_LIT>' ) . read ( ) <EOL> assert cass . play_count == <NUM_LIT:0> <EOL> last_mod = os . path . getmtime ( fname ) <EOL> with vcr . use_cassette ( fname ) as cass : <EOL> urlopen ( '<STR_LIT>' ) . read ( ) <EOL> assert cass . play_count == <NUM_LIT:1> <EOL> assert cass . dirty is False <EOL> last_mod2 = os . path . getmtime ( fname ) <EOL> assert last_mod == last_mod2 <EOL> def test_disk_saver_write ( tmpdir ) : <EOL> '''<STR_LIT>''' <EOL> fname = str ( tmpdir . join ( '<STR_LIT>' ) ) <EOL> with vcr . use_cassette ( fname ) as cass : <EOL> urlopen ( '<STR_LIT>' ) . read ( ) <EOL> assert cass . play_count == <NUM_LIT:0> <EOL> last_mod = os . path . getmtime ( fname ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> with vcr . use_cassette ( fname , record_mode = '<STR_LIT>' ) as cass : <EOL> urlopen ( '<STR_LIT>' ) . read ( ) <EOL> urlopen ( '<STR_LIT>' ) . read ( ) <EOL> assert cass . play_count == <NUM_LIT:1> <EOL> assert cass . dirty <EOL> last_mod2 = os . path . getmtime ( fname ) <EOL> assert last_mod != last_mod2 </s>
