mirror of https://github.com/borgbackup/borg.git
use "with" with open()
This commit is contained in:
parent
fec5572836
commit
dee9869a03
|
@ -262,10 +262,9 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
||||||
self.attic('extract', '--dry-run', self.repository_location + '::test')
|
self.attic('extract', '--dry-run', self.repository_location + '::test')
|
||||||
self.attic('check', self.repository_location)
|
self.attic('check', self.repository_location)
|
||||||
name = sorted(os.listdir(os.path.join(self.tmpdir, 'repository', 'data', '0')), reverse=True)[0]
|
name = sorted(os.listdir(os.path.join(self.tmpdir, 'repository', 'data', '0')), reverse=True)[0]
|
||||||
fd = open(os.path.join(self.tmpdir, 'repository', 'data', '0', name), 'r+')
|
with open(os.path.join(self.tmpdir, 'repository', 'data', '0', name), 'r+') as fd:
|
||||||
fd.seek(100)
|
fd.seek(100)
|
||||||
fd.write('XXXX')
|
fd.write('XXXX')
|
||||||
fd.close()
|
|
||||||
self.attic('check', self.repository_location, exit_code=1)
|
self.attic('check', self.repository_location, exit_code=1)
|
||||||
|
|
||||||
def test_readonly_repository(self):
|
def test_readonly_repository(self):
|
||||||
|
|
Loading…
Reference in New Issue