1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

pep8 fixes

This commit is contained in:
Kevin McCarthy
2013-08-23 19:56:13 -10:00
parent 98603541d6
commit c8299103fb
21 changed files with 177 additions and 76 deletions

View File

@@ -9,8 +9,12 @@ import time
# Internal imports
import vcr
def test_disk_saver_nowrite(tmpdir):
'''Ensure that when you close a cassette without changing it it doesn't rewrite the file'''
'''
Ensure that when you close a cassette without changing it it doesn't
rewrite the file
'''
fname = str(tmpdir.join('synopsis.yaml'))
with vcr.use_cassette(fname) as cass:
urllib2.urlopen('http://www.iana.org/domains/reserved').read()
@@ -20,21 +24,26 @@ def test_disk_saver_nowrite(tmpdir):
with vcr.use_cassette(fname) as cass:
urllib2.urlopen('http://www.iana.org/domains/reserved').read()
assert cass.play_count == 1
assert cass.dirty == False
assert cass.dirty is False
last_mod2 = os.path.getmtime(fname)
assert last_mod == last_mod2
def test_disk_saver_write(tmpdir):
'''Ensure that when you close a cassette after changing it it does rewrite the file'''
'''
Ensure that when you close a cassette after changing it it does
rewrite the file
'''
fname = str(tmpdir.join('synopsis.yaml'))
with vcr.use_cassette(fname) as cass:
urllib2.urlopen('http://www.iana.org/domains/reserved').read()
assert cass.play_count == 0
last_mod = os.path.getmtime(fname)
time.sleep(1) # Make sure at least 1 second passes, otherwise sometimes
# Make sure at least 1 second passes, otherwise sometimes
# the mtime doesn't change
time.sleep(1)
with vcr.use_cassette(fname) as cass:
urllib2.urlopen('http://www.iana.org/domains/reserved').read()
@@ -44,4 +53,3 @@ def test_disk_saver_write(tmpdir):
last_mod2 = os.path.getmtime(fname)
assert last_mod != last_mod2