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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
7e111959
Commit
7e111959
authored
Mar 8, 2023
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST: started refactoring the tests
parent
ef8d6f66
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
#34414
failed
Mar 8, 2023
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_tool.py
+15
-11
15 additions, 11 deletions
unittests/test_tool.py
with
15 additions
and
11 deletions
unittests/test_tool.py
+
15
−
11
View file @
7e111959
...
...
@@ -74,16 +74,17 @@ def dircheckstr(*pathcomponents):
@pytest.fixture
def
crawler
():
crawler
=
Crawler
(
debug
=
True
)
crawler
.
crawl_directory
(
rfp
(
"
test_directories
"
,
"
examples_article
"
),
crawler
=
Crawler
()
crawled_data
,
debug_tree
=
crawler
.
crawl_directory
(
rfp
(
"
test_directories
"
,
"
examples_article
"
),
rfp
(
"
scifolder_cfood.yml
"
))
return
crawler
return
crawler
,
crawled_data
,
debug_tree
@pytest.fixture
def
ident
(
crawler
):
ident
=
LocalStorageIdentifiableAdapter
()
crawler
.
identifiableAdapter
=
ident
crawler
[
0
]
.
identifiableAdapter
=
ident
# The records.xml file is constructed as follows:
# To a full run of the crawler, resolve all identifiables and insert all resulting entities.
...
...
@@ -112,8 +113,11 @@ def ident(crawler):
def
test_record_structure_generation
(
crawler
):
# TODO How does this test relate to the test function in test_scalars_cfood with the same name?
# There seems to be code duplication
subd
=
crawler
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
)]
subc
=
crawler
.
debug_metadata
[
"
copied
"
][
dircheckstr
(
"
DataAnalysis
"
)]
debug_tree
=
crawler
[
2
]
subd
=
debug_tree
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
)]
subc
=
debug_tree
.
debug_metadata
[
"
copied
"
][
dircheckstr
(
"
DataAnalysis
"
)]
assert
len
(
subd
)
==
2
# variables store on Data Analysis node of debug tree
assert
len
(
subd
[
0
])
==
4
...
...
@@ -127,9 +131,9 @@ def test_record_structure_generation(crawler):
assert
subd
[
0
][
"
DataAnalysis
"
]
==
"
examples_article/DataAnalysis
"
assert
subc
[
0
][
"
DataAnalysis
"
]
is
False
subd
=
crawler
.
debug_tree
[
dircheckstr
(
subd
=
debug_tree
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
,
"
2020_climate-model-predict
"
)]
subc
=
crawler
.
debug_metadata
[
"
copied
"
][
dircheckstr
(
subc
=
debug_tree
.
debug_metadata
[
"
copied
"
][
dircheckstr
(
"
DataAnalysis
"
,
"
2020_climate-model-predict
"
)]
assert
len
(
subd
[
1
])
==
1
...
...
@@ -157,10 +161,10 @@ def test_record_structure_generation(crawler):
assert
subc
[
0
][
"
date
"
]
is
False
assert
subc
[
0
][
"
identifier
"
]
is
False
subd
=
crawler
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
,
subd
=
debug_tree
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
,
"
2020_climate-model-predict
"
,
"
2020-02-08_prediction-errors
"
)]
subc
=
crawler
.
debug_metadata
[
"
copied
"
][
dircheckstr
(
"
DataAnalysis
"
,
subc
=
debug_tree
.
debug_metadata
[
"
copied
"
][
dircheckstr
(
"
DataAnalysis
"
,
"
2020_climate-model-predict
"
,
"
2020-02-08_prediction-errors
"
)]
assert
len
(
subd
[
0
])
==
12
...
...
...
...
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