diff options
author | Tushar Gohad <tushar.gohad@intel.com> | 2015-02-25 09:45:29 -0700 |
---|---|---|
committer | Tushar Gohad <tushar.gohad@intel.com> | 2015-02-25 09:45:29 -0700 |
commit | e1ef879d966ac7e250cb64aea8efeb2009222de0 (patch) | |
tree | a47bc5c726c83df9a42a8792427a1d7e4f6937bf /test | |
parent | e611b03b524005200256ffa537b775fd0b2b3abb (diff) | |
download | pyeclib-e1ef879d966ac7e250cb64aea8efeb2009222de0.tar.gz |
test: Run core tests only once
... under nosetests or manually with run_core_tests_manual.py
Add missing PYTHONPATH env to manual test_core invocation -
nose figures it out automagically.
Signed-off-by: Tushar Gohad <tushar.gohad@intel.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/run_core_tests_manual.py (renamed from test/test_core.py) | 25 | ||||
l--------- | test/run_core_tests_manual_valgrind.py | 1 | ||||
l--------- | test/test_core_valgrind.py | 1 |
3 files changed, 12 insertions, 15 deletions
diff --git a/test/test_core.py b/test/run_core_tests_manual.py index 698b445..e19b024 100644 --- a/test/test_core.py +++ b/test/run_core_tests_manual.py @@ -23,21 +23,18 @@ import os import sys -import unittest run_under_valgrind = False test_cmd_prefix = "" log_filename_prefix = "" -class TestCore(unittest.TestCase): +class CoreTests(): def __init__(self, *args): self.pyeclib_core_test = "test_pyeclib_c.py" self.pyeclib_iface_test = "test_pyeclib_api.py" - unittest.TestCase.__init__(self, *args) - def setUp(self): # Determine which directory we're in dirs = os.getcwd().split('/') @@ -55,8 +52,7 @@ class TestCore(unittest.TestCase): def tearDown(self): pass - def test_core(self): - self.assertTrue(True) + def invoke_core_tests(self): cur_dir = os.getcwd() print("\n") for (dir, test) in self.py_test_dirs: @@ -64,17 +60,18 @@ class TestCore(unittest.TestCase): sys.stdout.flush() os.chdir(dir) if os.path.isfile(test): + pythonpath = "PYTHONPATH=%s:%s" % \ + (cur_dir, os.path.dirname(cur_dir)) ret = os.system( - "%s python %s >%s/%s.%s.out 2>&1" % - (test_cmd_prefix, test, cur_dir, + "%s %s python %s >%s/%s.%s.out 2>&1" % + (pythonpath, test_cmd_prefix, test, cur_dir, log_filename_prefix, test)) - self.assertEqual(0, ret) + assert(0 == ret) os.system("rm -f *.pyc") os.chdir(cur_dir) print('ok') else: - self.assertTrue(False) print('failed') @@ -89,7 +86,7 @@ if __name__ == "__main__": run_under_valgrind = True test_cmd_prefix = "valgrind --leak-check=full " log_filename_prefix = "valgrind" - if sys.version_info<(2,7,0): - unittest.main() - else: - unittest.main(verbosity=2) + coretests = CoreTests() + coretests.setUp() + coretests.invoke_core_tests() + coretests.tearDown() diff --git a/test/run_core_tests_manual_valgrind.py b/test/run_core_tests_manual_valgrind.py new file mode 120000 index 0000000..f409632 --- /dev/null +++ b/test/run_core_tests_manual_valgrind.py @@ -0,0 +1 @@ +run_core_tests_manual.py
\ No newline at end of file diff --git a/test/test_core_valgrind.py b/test/test_core_valgrind.py deleted file mode 120000 index 329fee4..0000000 --- a/test/test_core_valgrind.py +++ /dev/null @@ -1 +0,0 @@ -test_core.py
\ No newline at end of file |