Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
0d636d4b
Commit
0d636d4b
authored
1 year ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into f-dict-heuristic
parents
9959dcb3
24686e48
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!163
F dict heuristic
Pipeline
#49212
failed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caoscrawler/identifiable_adapters.py
+3
-2
3 additions, 2 deletions
src/caoscrawler/identifiable_adapters.py
unittests/test_crawler.py
+10
-12
10 additions, 12 deletions
unittests/test_crawler.py
with
13 additions
and
14 deletions
src/caoscrawler/identifiable_adapters.py
+
3
−
2
View file @
0d636d4b
...
...
@@ -236,10 +236,11 @@ startswith: bool, optional
refs
.
extend
(
referencing_entities
[
rtname
])
found
=
True
if
not
found
:
raise
NotImplemented
Error
(
raise
Runtime
Error
(
f
"
Could not find referencing entities of type(s):
{
prop
.
value
}
\n
"
f
"
for registered identifiable:
\n
{
registered_identifiable
}
\n
"
f
"
There were
{
len
(
referencing_entities
)
}
referencing entities to choose from.
"
f
"
There were
{
len
(
referencing_entities
)
}
referencing entities to choose from.
\n
"
f
"
This error can also occur in case of merge conflicts in the referencing entities.
"
)
return
refs
...
...
This diff is collapsed.
Click to expand it.
unittests/test_crawler.py
+
10
−
12
View file @
0d636d4b
...
...
@@ -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
()
@pytest.mark.xfail
(
reason
=
"
https://gitlab.com/linkahead/linkahead-crawler/-/issues/88
"
)
@patch
(
"
caoscrawler.identifiable_adapters.cached_query
"
,
new
=
Mock
(
side_effect
=
mock_cached_only_rt
))
def
test_split_iiau_with_unmergeable_list_items
():
...
...
@@ -429,12 +428,16 @@ Identifiables
id_A: [prop_ident]
id_B: [prop_ident,
"
is_referenced_by: A
"
]
id_C: [prop_other,
"
is_referenced_by: B
"
]
Data
----
b1: (
"
same
"
, 23)
b2: (
"
same
"
, 42)
c1: (23)
c2: (42)
b1: (
"
same
"
, c1)
b2: (
"
same
"
, c2)
a: ([b1, b2])
"""
...
...
@@ -469,18 +472,13 @@ a: ([b1, b2])
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
:
crawler
.
synchronize
(
commit_changes
=
False
,
crawled_data
=
[
rec_a
,
*
rec_b
,
*
rec_c
])
assert
not
isinstance
(
rte
.
value
,
NotImplementedError
),
\
"
Exception must not be NotImplementedError, but plain RuntimeError.
"
assert
"
Could not find referencing entities
"
not
in
rte
.
value
.
args
[
0
]
assert
"
merging impossible
"
in
rte
.
something
# crawler.split_into_inserts_and_updates(ent_list=[rec_a, *rec_b, *rec_c])
assert
"
Could not find referencing entities
"
in
rte
.
value
.
args
[
0
]
assert
"
merge conflicts in the referencing
"
in
rte
.
value
.
args
[
0
]
def
test_has_missing_object_in_references
():
...
...
@@ -785,8 +783,8 @@ def test_split_into_inserts_and_updates_backref(crawler_mocked_for_backref_test)
entlist
=
[
referenced
,
db
.
Record
(
name
=
"
A
"
).
add_parent
(
"
BR
"
).
add_property
(
"
ref
"
,
referenced
),
]
# Test without referencing object
# currently a
NotImplemented
Error is raised if necessary properties are missing.
with
raises
(
NotImplemented
Error
):
# currently a
Runtime
Error is raised if necessary properties are missing.
with
raises
(
Runtime
Error
):
crawler
.
split_into_inserts_and_updates
([
db
.
Record
(
name
=
"
B
"
).
add_parent
(
"
C
"
)])
# identifiables were not yet checked
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment