Commit ae20b106 by Ben Patterson

Set paver command tests to run as part of unit test lib suites.

parent 6c757044
import os
import unittest
from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite
REPO_DIR = os.getcwd()
class TestPaverBokChoy(unittest.TestCase):
def setUp(self):
self.request = BokChoyTestSuite('')
def _expected_command(self, expected_text_append):
if expected_text_append:
expected_text_append = "/" + expected_text_append
expected_statement = ("SCREENSHOT_DIR='{repo_dir}/test_root/log' "
"HAR_DIR='{repo_dir}/test_root/log/hars' "
"SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
"nosetests {repo_dir}/common/test/acceptance/tests{exp_text} "
"--with-xunit "
"--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
"--verbosity=2 ".format(repo_dir=REPO_DIR,
exp_text=expected_text_append))
return expected_statement
def test_default_bokchoy(self):
self.assertEqual(self.request.cmd, self._expected_command(''))
def test_suite_request_bokchoy(self):
self.request.test_spec = "test_foo.py"
self.assertEqual(self.request.cmd, self._expected_command(self.request.test_spec))
def test_class_request_bokchoy(self):
self.request.test_spec = "test_foo.py:FooTest"
self.assertEqual(self.request.cmd, self._expected_command(self.request.test_spec))
def test_case_request_bokchoy(self):
self.request.test_spec = "test_foo.py:FooTest.test_bar"
self.assertEqual(self.request.cmd, self._expected_command(self.request.test_spec))
# TODO: Test when bok_choy test file is in a subdir
\ No newline at end of file
...@@ -79,7 +79,7 @@ def test_system(options): ...@@ -79,7 +79,7 @@ def test_system(options):
]) ])
def test_lib(options): def test_lib(options):
""" """
Run tests for common/lib/ Run tests for common/lib/ and pavelib/ (paver-tests)
""" """
lib = getattr(options, 'lib', None) lib = getattr(options, 'lib', None)
test_id = getattr(options, 'test_id', lib) test_id = getattr(options, 'test_id', lib)
......
import os
import unittest
from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite
REPO_DIR = os.getcwd()
class TestPaverBokChoy(unittest.TestCase):
def test_default_bokchoy(self):
command = BokChoyTestSuite('paver -t test_bokchoy')
expected_output = ("SCREENSHOT_DIR='{repo_dir}/test_root/log' "
"HAR_DIR='{repo_dir}/test_root/log/hars' "
"SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
"nosetests {repo_dir}/common/test/acceptance/tests "
"--with-xunit "
"--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
"--verbosity=2 ".format(repo_dir=REPO_DIR))
print expected_output
self.assertTrue(command.cmd == expected_output)
...@@ -109,6 +109,7 @@ class Env(object): ...@@ -109,6 +109,7 @@ class Env(object):
for item in (REPO_ROOT / "common/lib").listdir(): for item in (REPO_ROOT / "common/lib").listdir():
if (REPO_ROOT / 'common/lib' / item).isdir(): if (REPO_ROOT / 'common/lib' / item).isdir():
LIB_TEST_DIRS.append(path("common/lib") / item.basename()) LIB_TEST_DIRS.append(path("common/lib") / item.basename())
LIB_TEST_DIRS.append(path("pavelib/paver_tests"))
# Directory for i18n test reports # Directory for i18n test reports
I18N_REPORT_DIR = REPORT_DIR / 'i18n' I18N_REPORT_DIR = REPORT_DIR / 'i18n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment