mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-09 17:00:27 +03:00
run all SDK tools commands using SdkToolsPopen
This commit is contained in:
parent
9244256461
commit
fa1cc48d57
5 changed files with 58 additions and 38 deletions
46
tests/install.TestCase
Executable file
46
tests/install.TestCase
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# http://www.drdobbs.com/testing/unit-testing-with-python/240165163
|
||||
|
||||
import inspect
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
localmodule = os.path.realpath(os.path.join(
|
||||
os.path.dirname(inspect.getfile(inspect.currentframe())),
|
||||
'..'))
|
||||
print('localmodule: ' + localmodule)
|
||||
if localmodule not in sys.path:
|
||||
sys.path.insert(0,localmodule)
|
||||
|
||||
import fdroidserver.common
|
||||
import fdroidserver.install
|
||||
|
||||
class InstallTest(unittest.TestCase):
|
||||
'''fdroidserver/install.py'''
|
||||
|
||||
def test_devices(self):
|
||||
config = dict()
|
||||
config['sdk_path'] = os.getenv('ANDROID_HOME')
|
||||
fdroidserver.common.config = config
|
||||
config['adb'] = fdroidserver.common.find_sdk_tools_cmd('adb')
|
||||
self.assertTrue(os.path.exists(config['adb']))
|
||||
self.assertTrue(os.path.isfile(config['adb']))
|
||||
devices = fdroidserver.install.devices()
|
||||
self.assertIsInstance(devices, list, 'install.devices() did not return a list!')
|
||||
for device in devices:
|
||||
self.assertIsInstance(device, basestring)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
(fdroidserver.install.options, args) = parser.parse_args(['--verbose'])
|
||||
|
||||
newSuite = unittest.TestSuite()
|
||||
newSuite.addTest(unittest.makeSuite(InstallTest))
|
||||
unittest.main()
|
||||
|
|
@ -97,9 +97,9 @@ echo_header "test python getsig replacement"
|
|||
|
||||
cd $WORKSPACE/tests/getsig
|
||||
./make.sh
|
||||
cd $WORKSPACE/tests
|
||||
./common.TestCase
|
||||
./update.TestCase
|
||||
for testcase in $WORKSPACE/tests/*.TestCase; do
|
||||
$testcase
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue