From b5813e2a2acb7079072c27762af813483f1bec7c Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <alexander@mail-schlemmer.de> Date: Thu, 16 Dec 2021 12:22:06 +0100 Subject: [PATCH] ENH: add fixtures to unit tests --- src/newcrawler/crawl.py | 3 --- unittests/test_tool.py | 14 ++++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/newcrawler/crawl.py b/src/newcrawler/crawl.py index 7097c34f..6cf0ea9d 100644 --- a/src/newcrawler/crawl.py +++ b/src/newcrawler/crawl.py @@ -204,9 +204,6 @@ class Crawler(object): for i in reversed(range(len(updateList))): record = updateList[i] - if record.parents[0].name == "Measurement": - breakpoint() - # resolve references first: self.identifiableAdapter.resolve_references(record) identifiable = self.identifiableAdapter.retrieve_identifiable(record) diff --git a/unittests/test_tool.py b/unittests/test_tool.py index e5664461..7c8c2bba 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -12,13 +12,9 @@ import yaml import caosdb as db from caosdb.apiutils import compare_entities +import pytest from pytest import raises -# Some notes: -# Track provenance information in two ways: -# - DONE: provenance in structure elements and converters for properties of records -# - TODO: list whether information from structure elements and converters was used - def rfp(*pathcomponents): """ @@ -35,6 +31,13 @@ def dircheckstr(*pathcomponents): return "newcrawler.structure_elements.Directory: " + basename(join(*pathcomponents)) + ", " + rfp("test_directories", "examples_article", *pathcomponents) +@pytest.fixture +def crawler(): + crawler = Crawler(debug=True) + crawler.crawl_directory(rfp("test_directories", "examples_article"), + rfp("scifolder_cfood.yml")) + + def test_crawler(): crawler = Crawler(debug=True) crawler.crawl_directory(rfp("test_directories", "examples_article"), @@ -294,7 +297,6 @@ def test_crawler_update_list(): assert len(comp[1]["properties"]) == 0 insl, updl = crawler.synchronize(crawler.updateList) - breakpoint() assert len(insl) == 0 assert len(updl) == 0 -- GitLab