Provide a full path top level to test discovery
OS_TOP_LEVEL environment variable allows for the tempest code
to be in a different tree compared to .testr.conf.
However test_discover does not work because relative path is
passed in as top level. Fixing that.
Change-Id: Ieee0704c4895381bc64234bb18e720df67187aad
diff --git a/tempest/test_discover/test_discover.py b/tempest/test_discover/test_discover.py
index a871d10..86aa855 100644
--- a/tempest/test_discover/test_discover.py
+++ b/tempest/test_discover/test_discover.py
@@ -30,12 +30,14 @@
base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
base_path = os.path.split(base_path)[0]
# Load local tempest tests
- for test_dir in ['./tempest/api', './tempest/scenario',
- './tempest/thirdparty']:
+ for test_dir in ['tempest/api', 'tempest/scenario',
+ 'tempest/thirdparty']:
+ full_test_dir = os.path.join(base_path, test_dir)
if not pattern:
- suite.addTests(loader.discover(test_dir, top_level_dir=base_path))
+ suite.addTests(loader.discover(full_test_dir,
+ top_level_dir=base_path))
else:
- suite.addTests(loader.discover(test_dir, pattern=pattern,
+ suite.addTests(loader.discover(full_test_dir, pattern=pattern,
top_level_dir=base_path))
plugin_load_tests = ext_plugins.get_plugin_load_tests_tuple()