diff --git a/unittests/test_tool_extended.py b/unittests/test_tool_extended.py index 7137440554b4ec481ac595d54f38f3755120e938..6abe8925c22734230bcbfd7b6cb6cc2db7bf2186 100644 --- a/unittests/test_tool_extended.py +++ b/unittests/test_tool_extended.py @@ -26,11 +26,13 @@ def rfp(*pathcomponents): return join(dirname(__file__), *pathcomponents) -def dircheckstr(*pathcomponents): +def dircheckstr(*pathcomponents, structure_element_type="Directory"): """ Return the debug tree identifier for a given path. """ - return "newcrawler.structure_elements.Directory: " + basename(join(*pathcomponents)) + ", " + rfp("test_directories", "examples_article", *pathcomponents) + return ("newcrawler.structure_elements." + structure_element_type + ": " + + basename(join(*pathcomponents)) + ", " + + rfp("test_directories", "examples_article", *pathcomponents)) @pytest.fixture @@ -72,7 +74,9 @@ def crawler(): def test_file_structure_generation(crawler): subd = crawler.debug_tree[dircheckstr("DataAnalysis")] subc = crawler.debug_metadata["copied"][dircheckstr("DataAnalysis")] - sd = crawler.debug_tree['newcrawler.structure_elements.File: README.md, /home/salexan/Projekte/CaosDB/caosdb-newcrawler/unittests/test_directories/examples_article/SimulationData/2020_climate-model-predict/2020-02-01/README.md'] + sd = crawler.debug_tree[dircheckstr("SimulationData", + "2020_climate-model-predict", "2020-02-01", + "README.md", structure_element_type="File")] assert sd[1]["ReadmeFile"].role == "File" assert len(sd[1]["ReadmeFile"].path) > 0 assert len(sd[1]["ReadmeFile"].file) > 0