diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index 5475d2c1a7ed4a12ebc2080282713ad724cc2df1..3fd67e4bf2915d2755133ef8d4b8387b073a26a2 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -641,7 +641,7 @@ class Crawler(object): + str(self.compact_entity_list_representation(flat))) else: logger.error("Found circular dependency (Note that this might include references " - "that are not identifying properties: " + "that are not identifying properties): " + self.compact_entity_list_representation(circle)) raise RuntimeError( f"Could not finish split_into_inserts_and_updates. Circular dependency: " @@ -681,7 +681,7 @@ class Crawler(object): """ Detects whether there are circular references in the given entity list and returns a list where the entities are ordered according to the chain of references (and only the entities - contained in the circle are included. + contained in the circle are included. Returns None if no circular dependency is found. TODO: for the sake of detecting problems for split_into_inserts_and_updates we should only consider references that are identifying properties. diff --git a/unittests/test_crawler.py b/unittests/test_crawler.py index 8db4e9c57e62d7c9bfe3f53df92a900b61292249..7c592b434fe75f61b4076f91ccd0c3ce61227d1a 100644 --- a/unittests/test_crawler.py +++ b/unittests/test_crawler.py @@ -874,8 +874,7 @@ def test_detect_circular_dependency(crawler_mocked_identifiable_retrieve, caplog circle = Crawler.detect_circular_dependency(flat) assert [id(el) for el in circle] == [id(el) for el in [a, c, b, a]] - with raises(Exception): - detect_circular_dependency([d]) + assert detect_circular_dependency([d]) is None with raises(RuntimeError): _, _ = crawler.split_into_inserts_and_updates(flat) caplog.set_level(logging.ERROR, logger="caoscrawler.converters")