diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index 68a0977cac8a9f0c3a3f57191a256fb04dbe2b7b..d95af7f0eedc96f1ac263b33c7bb620fce57c2e6 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -38,7 +38,7 @@ import logging import os import sys import uuid -from caosdb.cached import cached_get_entity_by +from caosdb.cached import cached_get_entity_by, cache_clear import warnings import yaml @@ -847,6 +847,7 @@ class Crawler(object): logger.info(f"Going to insert {len(to_be_inserted)} Entities and update " f"{len(to_be_updated)} Entities.") if commit_changes: + cache_clear() self.execute_parent_updates_in_list(to_be_updated, securityMode=self.securityMode, run_id=self.run_id, unique_names=unique_names) logger.info(f"Added parent RecordTypes where necessary.") diff --git a/unittests/test_tool.py b/unittests/test_tool.py index 0853cb3379a312ebf2a853a1ed1294192c0b5369..c8b11523211c66c1dfe6d7bf2d6938bdf9ff662a 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -46,7 +46,7 @@ from os.path import join, dirname, basename import yaml import caosdb as db from caosdb.apiutils import compare_entities - +from caosdb.cached import cache_clear import pytest from pytest import raises @@ -76,6 +76,11 @@ def dircheckstr(*pathcomponents): "test_directories", "examples_article", *pathcomponents)) +@pytest.fixture +def clear_cache(autouse=True): + cache_clear() + + @pytest.fixture def crawler(): crawler = Crawler()