summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/contrib/tts/tests.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-07-30 19:25:09 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-01 11:26:13 +0100
commit1640a65091c56eeed0f6bb1020fd156cdc279a6e (patch)
treeee36a0a10c1fea4d5e10e645b9077f80d6d67567 /bitbake/lib/toaster/contrib/tts/tests.py
parent160d610604fff0b119de2b70a9da8a5f73d93715 (diff)
downloadpoky-1640a65091c56eeed0f6bb1020fd156cdc279a6e.tar.gz
bitbake: toaster: tts: fix pylint warnings
This patch brings TTS to the pylint coding standards. Pylint was run with some disables: disable=logging-too-many-args,line-too-long,missing-docstring and achieved Your code has been rated at 10.00/10 There are no functional changes. (Bitbake rev: 2b40b412ff6a7e3fd4cc32707bd3cd713bc09ddb) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/contrib/tts/tests.py')
-rw-r--r--bitbake/lib/toaster/contrib/tts/tests.py43
1 files changed, 20 insertions, 23 deletions
diff --git a/bitbake/lib/toaster/contrib/tts/tests.py b/bitbake/lib/toaster/contrib/tts/tests.py
index 15a9a874ff..eb91947d83 100644
--- a/bitbake/lib/toaster/contrib/tts/tests.py
+++ b/bitbake/lib/toaster/contrib/tts/tests.py
@@ -24,7 +24,8 @@
24# as this file. 24# as this file.
25 25
26import unittest 26import unittest
27from shellutils import * 27from shellutils import run_shell_cmd, ShellCmdException
28import config
28 29
29import pexpect 30import pexpect
30import sys, os, signal, time 31import sys, os, signal, time
@@ -33,12 +34,9 @@ class TestPyCompilable(unittest.TestCase):
33 ''' Verifies that all Python files are syntactically correct ''' 34 ''' Verifies that all Python files are syntactically correct '''
34 def test_compile_file(self): 35 def test_compile_file(self):
35 try: 36 try:
36 out = run_shell_cmd("find . -name *py -type f -print0 | xargs -0 -n1 -P20 python -m py_compile", config.testdir) 37 run_shell_cmd("find . -name *py -type f -print0 | xargs -0 -n1 -P20 python -m py_compile", config.TESTDIR)
37 except ShellCmdException as e: 38 except ShellCmdException as exc:
38 self.fail("Error compiling python files: %s" % (e)) 39 self.fail("Error compiling python files: %s" % (exc))
39 except Exception as e:
40 self.fail("Unknown error: %s" % e)
41
42 40
43class TestPySystemStart(unittest.TestCase): 41class TestPySystemStart(unittest.TestCase):
44 ''' Attempts to start Toaster, verify that it is succesfull, and stop it ''' 42 ''' Attempts to start Toaster, verify that it is succesfull, and stop it '''
@@ -47,29 +45,28 @@ class TestPySystemStart(unittest.TestCase):
47 45
48 def test_start_interactive_mode(self): 46 def test_start_interactive_mode(self):
49 try: 47 try:
50 run_shell_cmd("bash -c 'source %s/oe-init-build-env && source toaster start webport=%d && source toaster stop'" % (config.testdir, config.TOASTER_PORT), config.testdir) 48 run_shell_cmd("bash -c 'source %s/oe-init-build-env && source toaster start webport=%d && source toaster stop'" % (config.TESTDIR, config.TOASTER_PORT), config.TESTDIR)
51 except ShellCmdException as e: 49 except ShellCmdException as exc:
52 self.fail("Failed starting interactive mode: %s" % (e)) 50 self.fail("Failed starting interactive mode: %s" % (exc))
53 51
54 def test_start_managed_mode(self): 52 def test_start_managed_mode(self):
55 try: 53 try:
56 run_shell_cmd("%s/bitbake/bin/toaster webport=%d nobrowser & sleep 10 && curl http://localhost:%d/ && kill -2 %1" % (config.testdir, config.TOASTER_PORT, config.TOASTER_PORT), config.testdir) 54 run_shell_cmd("%s/bitbake/bin/toaster webport=%d nobrowser & sleep 10 && curl http://localhost:%d/ && kill -2 %%1" % (config.TESTDIR, config.TOASTER_PORT, config.TOASTER_PORT), config.TESTDIR)
57 pass 55 except ShellCmdException as exc:
58 except ShellCmdException as e: 56 self.fail("Failed starting managed mode: %s" % (exc))
59 self.fail("Failed starting managed mode: %s" % (e))
60 57
61class TestHTML5Compliance(unittest.TestCase): 58class TestHTML5Compliance(unittest.TestCase):
62 def setUp(self): 59 def setUp(self):
63 self.origdir = os.getcwd() 60 self.origdir = os.getcwd()
64 self.crtdir = os.path.dirname(config.testdir) 61 self.crtdir = os.path.dirname(config.TESTDIR)
65 os.chdir(self.crtdir) 62 os.chdir(self.crtdir)
66 if not os.path.exists(os.path.join(self.crtdir, "toaster.sqlite")): 63 if not os.path.exists(os.path.join(self.crtdir, "toaster.sqlite")):
67 run_shell_cmd("%s/bitbake/lib/toaster/manage.py syncdb --noinput" % config.testdir) 64 run_shell_cmd("%s/bitbake/lib/toaster/manage.py syncdb --noinput" % config.TESTDIR)
68 run_shell_cmd("%s/bitbake/lib/toaster/manage.py migrate orm" % config.testdir) 65 run_shell_cmd("%s/bitbake/lib/toaster/manage.py migrate orm" % config.TESTDIR)
69 run_shell_cmd("%s/bitbake/lib/toaster/manage.py migrate bldcontrol" % config.testdir) 66 run_shell_cmd("%s/bitbake/lib/toaster/manage.py migrate bldcontrol" % config.TESTDIR)
70 run_shell_cmd("%s/bitbake/lib/toaster/manage.py loadconf %s/meta-yocto/conf/toasterconf.json" % (config.testdir, config.testdir)) 67 run_shell_cmd("%s/bitbake/lib/toaster/manage.py loadconf %s/meta-yocto/conf/toasterconf.json" % (config.TESTDIR, config.TESTDIR))
71 68
72 setup = pexpect.spawn("%s/bitbake/lib/toaster/manage.py checksettings" % config.testdir) 69 setup = pexpect.spawn("%s/bitbake/lib/toaster/manage.py checksettings" % config.TESTDIR)
73 setup.logfile = sys.stdout 70 setup.logfile = sys.stdout
74 setup.expect(r".*or type the full path to a different directory: ") 71 setup.expect(r".*or type the full path to a different directory: ")
75 setup.sendline('') 72 setup.sendline('')
@@ -79,8 +76,8 @@ class TestHTML5Compliance(unittest.TestCase):
79 setup.expect(r"Enter your option: ") 76 setup.expect(r"Enter your option: ")
80 setup.sendline('0') 77 setup.sendline('0')
81 78
82 self.child = pexpect.spawn("%s/bitbake/bin/toaster webport=%d nobrowser" % (config.testdir, config.TOASTER_PORT)) 79 self.child = pexpect.spawn("%s/bitbake/bin/toaster webport=%d nobrowser" % (config.TESTDIR, config.TOASTER_PORT))
83 self.child.logfile=sys.stdout 80 self.child.logfile = sys.stdout
84 self.child.expect("Toaster is now running. You can stop it with Ctrl-C") 81 self.child.expect("Toaster is now running. You can stop it with Ctrl-C")
85 82
86 def test_html5_compliance(self): 83 def test_html5_compliance(self):
@@ -95,7 +92,7 @@ class TestHTML5Compliance(unittest.TestCase):
95 failed.append((url, results[url])) 92 failed.append((url, results[url]))
96 93
97 94
98 self.assertTrue(len(failed)== 0, "Not all URLs validate: \n%s " % "\n".join(map(lambda x: "".join(str(x)),failed))) 95 self.assertTrue(len(failed) == 0, "Not all URLs validate: \n%s " % "\n".join(["".join(str(x)) for x in failed]))
99 96
100 #(config.TOASTER_BASEURL + url, status, errors, warnings)) 97 #(config.TOASTER_BASEURL + url, status, errors, warnings))
101 98