Skip to content
Snippets Groups Projects
Commit 7386b74f authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

TST: Fix error message

parent ef90af25
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!164F fix misleading error
This commit is part of merge request !164. Comments created here will be created in the context of that merge request.
...@@ -405,7 +405,6 @@ def test_split_into_inserts_and_updates_with_copy_attr(crawler_mocked_identifiab ...@@ -405,7 +405,6 @@ def test_split_into_inserts_and_updates_with_copy_attr(crawler_mocked_identifiab
crawler.identifiableAdapter.retrieve_identified_record_for_identifiable.assert_called() crawler.identifiableAdapter.retrieve_identified_record_for_identifiable.assert_called()
@pytest.mark.xfail(reason="https://gitlab.com/linkahead/linkahead-crawler/-/issues/88")
@patch("caoscrawler.identifiable_adapters.cached_query", @patch("caoscrawler.identifiable_adapters.cached_query",
new=Mock(side_effect=mock_cached_only_rt)) new=Mock(side_effect=mock_cached_only_rt))
def test_split_iiau_with_unmergeable_list_items(): def test_split_iiau_with_unmergeable_list_items():
...@@ -429,12 +428,16 @@ Identifiables ...@@ -429,12 +428,16 @@ Identifiables
id_A: [prop_ident] id_A: [prop_ident]
id_B: [prop_ident, "is_referenced_by: A"] id_B: [prop_ident, "is_referenced_by: A"]
id_C: [prop_other, "is_referenced_by: B"]
Data Data
---- ----
b1: ("same", 23) c1: (23)
b2: ("same", 42) c2: (42)
b1: ("same", c1)
b2: ("same", c2)
a: ([b1, b2]) a: ([b1, b2])
""" """
...@@ -469,18 +472,13 @@ a: ([b1, b2]) ...@@ -469,18 +472,13 @@ a: ([b1, b2])
crawler = Crawler(identifiableAdapter=ident_adapter) crawler = Crawler(identifiableAdapter=ident_adapter)
# This should give a merge conflict, and not
# "Could not find referencing entities of type(s): A"
# from IPython import embed; embed()
with raises(RuntimeError) as rte: with raises(RuntimeError) as rte:
crawler.synchronize(commit_changes=False, crawler.synchronize(commit_changes=False,
crawled_data=[rec_a, *rec_b, *rec_c]) crawled_data=[rec_a, *rec_b, *rec_c])
assert not isinstance(rte.value, NotImplementedError), \ assert not isinstance(rte.value, NotImplementedError), \
"Exception must not be NotImplementedError, but plain RuntimeError." "Exception must not be NotImplementedError, but plain RuntimeError."
assert "Could not find referencing entities" not in rte.value.args[0] assert "Could not find referencing entities" in rte.value.args[0]
assert "merging impossible" in rte.something assert "merge conflicts in the referencing" in rte.value.args[0]
# crawler.split_into_inserts_and_updates(ent_list=[rec_a, *rec_b, *rec_c])
def test_has_missing_object_in_references(): def test_has_missing_object_in_references():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment