Changeset View
Changeset View
Standalone View
Standalone View
swh/scanner/tests/conftest.py
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | def example_dirs(example_tree, temp_folder): | ||||
root = temp_folder["root"] | root = temp_folder["root"] | ||||
filesample_path = temp_folder["filesample"] | filesample_path = temp_folder["filesample"] | ||||
filesample2_path = temp_folder["filesample2"] | filesample2_path = temp_folder["filesample2"] | ||||
subsubdir_path = temp_folder["subsubdir"] | subsubdir_path = temp_folder["subsubdir"] | ||||
known_paths = [filesample_path, filesample2_path, subsubdir_path] | known_paths = [filesample_path, filesample2_path, subsubdir_path] | ||||
for path, swhid in temp_folder["paths"].items(): | for path, swhid in temp_folder["paths"].items(): | ||||
if path in known_paths: | if path in known_paths: | ||||
example_tree.addNode(path, swhid, True) | example_tree.add_node(path, swhid, True) | ||||
else: | else: | ||||
example_tree.addNode(path, swhid, False) | example_tree.add_node(path, swhid, False) | ||||
return example_tree.getDirectoriesInfo(root) | return example_tree.get_directories_info(root) | ||||
@pytest.fixture | @pytest.fixture | ||||
def test_sample_folder(datadir, tmp_path): | def test_sample_folder(datadir, tmp_path): | ||||
"""Location of the "data" folder """ | """Location of the "data" folder """ | ||||
archive_path = Path(os.path.join(datadir, "sample-folder.tgz")) | archive_path = Path(os.path.join(datadir, "sample-folder.tgz")) | ||||
assert archive_path.exists() | assert archive_path.exists() | ||||
shutil.unpack_archive(archive_path, extract_dir=tmp_path) | shutil.unpack_archive(archive_path, extract_dir=tmp_path) | ||||
Show All 10 Lines |