def setup_class(cls): """Build the instance.""" # nose does some amazing magic that makes this work even if there are # multiple test modules with the same name: cls._config_dir_path = dirname(sys.modules[cls.__module__].__file__) chdir(cls._config_dir_path) run('dxr index') cls._es().refresh()
def clean(config, tree_names): """Remove logs, temp files, and build artifacts. Remove the filesystem debris left after indexing one or more TREES, leaving the index itself intact. Delete log files and, if present, temp files. Run `make clean` (or other clean_command from the config file) on trees. """ for tree in tree_objects(tree_names, config): rmtree_if_exists(tree.log_folder) rmtree_if_exists(tree.temp_folder) chdir(tree.object_folder) if tree.clean_command: try: run(tree.clean_command) except CommandFailure as exc: raise ClickException( 'Running clean_command failed for "%s" tree: %s.' % (tree.name, str(exc)))
def teardown_class(cls): chdir(cls._config_dir_path) cls._delete_es_indices() # TODO: Replace with a call to 'dxr delete --force'. run('dxr clean')
def dxr_index(cls): """Run the `dxr index` command in the config file's directory.""" with cd(cls._config_dir_path): run('dxr index')
def teardown_class(cls): with cd(cls._config_dir_path): run('dxr clean') super(DxrInstanceTestCase, cls).teardown_class()