def test_options_config(self): """Test the --config option""" # First, test without using the wrapper so that no --config option is # given to the service eq_(export_service(['--url', 'non-existent-repo']), 1) # Create config file with open('my.conf', 'w') as conf: conf.write('[general]\n') conf.write('repo-cache-dir = my-repo-cache\n') # Mangle environment and remove default cache default_cache = os.environ['OBS_GBS_REPO_CACHE_DIR'] del os.environ['OBS_GBS_REPO_CACHE_DIR'] shutil.rmtree(default_cache) # Check that the repo cache we configured is actually used eq_(service(['--url', self.orig_repo.path, '--config', 'my.conf']), 0) ok_(not os.path.exists(default_cache), os.listdir('.')) ok_(os.path.exists('my-repo-cache'), os.listdir('.'))
def service(argv=None): """Wrapper for service""" # Set non-existent config file so that user/system settings don't affect # tests dummy_conf = os.path.abspath(os.path.join(os.path.curdir, 'gbs.noconfig')) return export_service(['--config', dummy_conf] + argv)