diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py index d84f3a3345..6e93d69609 100644 --- a/tempest/cmd/init.py +++ b/tempest/cmd/init.py @@ -44,11 +44,14 @@ def get_tempest_default_config_dir(): :return: default config dir """ + # NOTE: The default directory should be on a Linux box. global_conf_dir = '/etc/tempest' xdg_config = os.environ.get('XDG_CONFIG_HOME', - os.path.expanduser('~/.config')) + os.path.expanduser(os.path.join('~', + '.config'))) user_xdg_global_path = os.path.join(xdg_config, 'tempest') - user_global_path = os.path.join(os.path.expanduser('~'), '.tempest/etc') + user_global_path = os.path.join(os.path.expanduser('~'), + '.tempest', 'etc') if os.path.isdir(global_conf_dir): return global_conf_dir elif os.path.isdir(user_xdg_global_path): @@ -121,7 +124,7 @@ class TempestInit(command.Command): def generate_sample_config(self, local_dir): conf_generator = os.path.join(os.path.dirname(__file__), 'config-generator.tempest.conf') - output_file = os.path.join(local_dir, 'etc/tempest.conf.sample') + output_file = os.path.join(local_dir, 'etc', 'tempest.conf.sample') if os.path.isfile(conf_generator): generator.main(['--config-file', conf_generator, '--output-file', output_file]) diff --git a/tempest/lib/cmd/skip_tracker.py b/tempest/lib/cmd/skip_tracker.py index 87806b7fc1..95376e3937 100755 --- a/tempest/lib/cmd/skip_tracker.py +++ b/tempest/lib/cmd/skip_tracker.py @@ -31,10 +31,11 @@ try: except ImportError: launchpad = None -LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache') +LPCACHEDIR = os.path.expanduser(os.path.join('~', '.launchpadlib', 'cache')) LOG = logging.getLogger(__name__) -BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')) +BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), + '..', '..', '..')) TESTDIR = os.path.join(BASEDIR, 'tempest') diff --git a/tempest/lib/common/preprov_creds.py b/tempest/lib/common/preprov_creds.py index 10115041eb..641d7272bb 100644 --- a/tempest/lib/common/preprov_creds.py +++ b/tempest/lib/common/preprov_creds.py @@ -172,7 +172,7 @@ class PreProvisionedCredentialProvider(cred_provider.CredentialProvider): return self.is_multi_user() def _create_hash_file(self, hash_string): - path = os.path.join(os.path.join(self.accounts_dir, hash_string)) + path = os.path.join(self.accounts_dir, hash_string) if not os.path.isfile(path): with open(path, 'w') as fd: fd.write(self.name) @@ -194,8 +194,7 @@ class PreProvisionedCredentialProvider(cred_provider.CredentialProvider): if res: return _hash else: - path = os.path.join(os.path.join(self.accounts_dir, - _hash)) + path = os.path.join(self.accounts_dir, _hash) with open(path, 'r') as fd: names.append(fd.read()) msg = ('Insufficient number of users provided. %s have allocated all ' diff --git a/tempest/test_discover/test_discover.py b/tempest/test_discover/test_discover.py index 143c6e1627..5816ab1d2d 100644 --- a/tempest/test_discover/test_discover.py +++ b/tempest/test_discover/test_discover.py @@ -30,8 +30,8 @@ def load_tests(loader, tests, pattern): 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']: - full_test_dir = os.path.join(base_path, test_dir) + for test_dir in ['api', 'scenario']: + full_test_dir = os.path.join(base_path, 'tempest', test_dir) if not pattern: suite.addTests(loader.discover(full_test_dir, top_level_dir=base_path)) diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py index 9042b12f35..fce08826cc 100644 --- a/tempest/tests/cmd/test_tempest_init.py +++ b/tempest/tests/cmd/test_tempest_init.py @@ -40,7 +40,7 @@ class TestTempestInit(base.TestCase): def test_generate_sample_config(self): local_dir = self.useFixture(fixtures.TempDir()) - etc_dir_path = os.path.join(local_dir.path, 'etc/') + etc_dir_path = os.path.join(local_dir.path, 'etc') os.mkdir(etc_dir_path) init_cmd = init.TempestInit(None, None) local_sample_conf_file = os.path.join(etc_dir_path, @@ -56,7 +56,7 @@ class TestTempestInit(base.TestCase): def test_update_local_conf(self): local_dir = self.useFixture(fixtures.TempDir()) - etc_dir_path = os.path.join(local_dir.path, 'etc/') + etc_dir_path = os.path.join(local_dir.path, 'etc') os.mkdir(etc_dir_path) lock_dir = os.path.join(local_dir.path, 'tempest_lock') config_path = os.path.join(etc_dir_path, 'tempest.conf') diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py index 721fd76e54..277e0498f9 100644 --- a/tempest/tests/cmd/test_verify_tempest_config.py +++ b/tempest/tests/cmd/test_verify_tempest_config.py @@ -579,7 +579,7 @@ class TestDiscovery(base.TestCase): os, 'fakeservice') def test_get_config_file(self): - conf_dir = os.path.join(os.getcwd(), 'etc/') + conf_dir = os.path.join(os.getcwd(), 'etc') conf_file = "tempest.conf.sample" local_sample_conf_file = os.path.join(conf_dir, conf_file)