mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
tests: close files
This commit is contained in:
parent
f7e9022217
commit
00bd75aa8c
@ -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__":
|
||||
|
@ -140,10 +140,12 @@ class CommonTest(unittest.TestCase):
|
||||
|
||||
fdroidserver.common.prepare_source(FakeVcs(), app, build, testdir, testdir, testdir)
|
||||
|
||||
filedata = open(os.path.join(testdir, 'build.gradle')).read()
|
||||
with open(os.path.join(testdir, 'build.gradle'), 'r') as f:
|
||||
filedata = f.read()
|
||||
self.assertIsNotNone(re.search("\s+compileSdkVersion %s\s+" % testint, filedata))
|
||||
|
||||
filedata = open(os.path.join(testdir, 'AndroidManifest.xml')).read()
|
||||
with open(os.path.join(testdir, 'AndroidManifest.xml')) as f:
|
||||
filedata = f.read()
|
||||
self.assertIsNone(re.search('android:debuggable', filedata))
|
||||
self.assertIsNotNone(re.search('android:versionName="%s"' % build['version'], filedata))
|
||||
self.assertIsNotNone(re.search('android:versionCode="%s"' % build['vercode'], filedata))
|
||||
|
@ -39,7 +39,8 @@ class MetadataTest(unittest.TestCase):
|
||||
|
||||
apps = fdroidserver.metadata.read_metadata(xref=True)
|
||||
for appid in ('org.smssecure.smssecure', 'org.adaway', 'net.osmand.plus', 'org.videolan.vlc'):
|
||||
frompickle = pickle.load(open(os.path.join('metadata', appid + '.pickle')))
|
||||
with open(os.path.join('metadata', appid + '.pickle'), 'r') as f:
|
||||
frompickle = pickle.load(f)
|
||||
self.assertTrue(appid in apps.keys())
|
||||
self.assertEquals(apps[appid], frompickle)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user