tests: close files

This commit is contained in:
Daniel Martí 2015-10-08 13:20:35 +02:00
parent f7e9022217
commit 00bd75aa8c
3 changed files with 10 additions and 5 deletions

View file

@ -63,11 +63,13 @@ class BuildTest(unittest.TestCase):
'source-files/Zillode/syncthing-silk/build.gradle',
'source-files/open-keychain/open-keychain/build.gradle',
'source-files/osmandapp/osmand/build.gradle'):
filedata = open(os.path.join(testsdir, f)).read()
with open(os.path.join(testsdir, f), 'r') as f:
filedata = f.read()
self.assertIsNotNone(pattern.search(filedata))
tp = os.path.join(testsdir,
'source-files/open-keychain/open-keychain/OpenKeychain/build.gradle')
filedata = open(tp).read()
with open(tp, 'r') as f:
filedata = f.read()
self.assertIsNone(pattern.search(filedata))
if __name__ == "__main__":