Merge pull request #5118 from edx/benp/paver-tests
Add tests for paver bok_choy commands
This commit is contained in:
0
pavelib/paver_tests/__init__.py
Normal file
0
pavelib/paver_tests/__init__.py
Normal file
43
pavelib/paver_tests/test_paver_bok_choy_cmds.py
Normal file
43
pavelib/paver_tests/test_paver_bok_choy_cmds.py
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
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
|
||||
@@ -79,7 +79,7 @@ def test_system(options):
|
||||
])
|
||||
def test_lib(options):
|
||||
"""
|
||||
Run tests for common/lib/
|
||||
Run tests for common/lib/ and pavelib/ (paver-tests)
|
||||
"""
|
||||
lib = getattr(options, 'lib', None)
|
||||
test_id = getattr(options, 'test_id', lib)
|
||||
|
||||
@@ -109,6 +109,7 @@ class Env(object):
|
||||
for item in (REPO_ROOT / "common/lib").listdir():
|
||||
if (REPO_ROOT / 'common/lib' / item).isdir():
|
||||
LIB_TEST_DIRS.append(path("common/lib") / item.basename())
|
||||
LIB_TEST_DIRS.append(path("pavelib/paver_tests"))
|
||||
|
||||
# Directory for i18n test reports
|
||||
I18N_REPORT_DIR = REPORT_DIR / 'i18n'
|
||||
|
||||
Reference in New Issue
Block a user