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
e3bc51fc
Commit
e3bc51fc
authored
2 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
FIX: fixed test_usses by introducing a function in the crawl module to generate a run id manually
parent
a49b4404
No related branches found
No related tags found
2 merge requests
!108
Release 0.5.0
,
!104
Create a new scanner module and move functions from crawl module there
Pipeline
#34474
failed
2 years 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
integrationtests/test_issues.py
+7
-4
7 additions, 4 deletions
integrationtests/test_issues.py
src/caoscrawler/crawl.py
+4
-1
4 additions, 1 deletion
src/caoscrawler/crawl.py
with
11 additions
and
5 deletions
integrationtests/test_issues.py
+
7
−
4
View file @
e3bc51fc
...
...
@@ -24,6 +24,8 @@ from caoscrawler.crawl import Crawler
from
caoscrawler.identifiable_adapters
import
CaosDBIdentifiableAdapter
from
caoscrawler.structure_elements
import
DictElement
from
caoscrawler.scanner
import
create_converter_registry
,
scan_structure_elements
from
caosdb.utils.register_tests
import
clear_database
,
set_test_key
set_test_key
(
"
10b128cf8a1372f30aa3697466bb55e76974e0c16a599bb44ace88f19c8f61e2
"
)
...
...
@@ -86,8 +88,8 @@ def test_issue_23(clear_database):
ident
.
register_identifiable
(
"
TestType
"
,
db
.
RecordType
().
add_parent
(
name
=
"
TestType
"
).
add_property
(
name
=
"
identifying_prop
"
))
crawler
=
Crawler
(
debug
=
True
,
identifiableAdapter
=
ident
)
converter_registry
=
cr
awler
.
load
_converter
s
(
crawler_definition
)
crawler
=
Crawler
(
identifiableAdapter
=
ident
)
converter_registry
=
cr
eate
_converter
_registry
(
crawler_definition
)
# the dictionary to be crawled...
test_dict
=
{
...
...
@@ -95,7 +97,8 @@ def test_issue_23(clear_database):
"
prop_b
"
:
"
something_else
"
}
records
=
crawler
.
start_crawling
(
crawler
.
generate_run_id
()
records
,
debug_tree
=
scan_structure_elements
(
DictElement
(
"
TestDict
"
,
test_dict
),
crawler_definition
,
converter_registry
)
assert
len
(
records
)
==
1
...
...
@@ -109,7 +112,7 @@ def test_issue_23(clear_database):
assert
rec_crawled
.
get_property
(
"
prop_a
"
)
is
None
# synchronize with database and update the record
ins
,
ups
=
crawler
.
synchronize
()
ins
,
ups
=
crawler
.
synchronize
(
records
)
assert
len
(
ins
)
==
0
assert
len
(
ups
)
==
1
...
...
This diff is collapsed.
Click to expand it.
src/caoscrawler/crawl.py
+
4
−
1
View file @
e3bc51fc
...
...
@@ -203,6 +203,9 @@ class Crawler(object):
if
identifiableAdapter
is
not
None
:
self
.
identifiableAdapter
=
identifiableAdapter
def
generate_run_id
(
self
):
self
.
run_id
=
uuid
.
uuid1
()
def
crawl_directory
(
self
,
crawled_directory
:
str
,
crawler_definition_path
:
str
,
...
...
@@ -212,7 +215,7 @@ class Crawler(object):
"""
self
.
crawled_directory
=
crawled_directory
self
.
run_id
=
uuid
.
uuid1
()
self
.
generate_run_id
()
# TODO: This is not ideal yet, the data is just returned and needs to be
# separately supplied to the synchronize function.
...
...
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