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
3304b0ae
Commit
3304b0ae
authored
1 year ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST: a second test for variable deletion behavior
parent
0c6b2cf6
No related branches found
No related tags found
2 merge requests
!160
STY: styling
,
!125
F delete variables correctly
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caoscrawler/scanner.py
+8
-0
8 additions, 0 deletions
src/caoscrawler/scanner.py
unittests/test_scanner.py
+14
-3
14 additions, 3 deletions
unittests/test_scanner.py
with
22 additions
and
3 deletions
src/caoscrawler/scanner.py
+
8
−
0
View file @
3304b0ae
...
@@ -355,9 +355,17 @@ def scan_directory(dirname: str, crawler_definition_path: str,
...
@@ -355,9 +355,17 @@ def scan_directory(dirname: str, crawler_definition_path: str,
Convenience function that starts the crawler (calls start_crawling)
Convenience function that starts the crawler (calls start_crawling)
with a single directory as the StructureElement.
with a single directory as the StructureElement.
Parameters
----------
restricted_path: optional, list of strings
restricted_path: optional, list of strings
Traverse the data tree only along the given path. When the end of the given path
Traverse the data tree only along the given path. When the end of the given path
is reached, traverse the full tree as normal.
is reached, traverse the full tree as normal.
Returns
-------
crawled_data : list
the final list with the target state of Records.
"""
"""
crawler_definition
=
load_definition
(
crawler_definition_path
)
crawler_definition
=
load_definition
(
crawler_definition_path
)
...
...
This diff is collapsed.
Click to expand it.
unittests/test_scanner.py
+
14
−
3
View file @
3304b0ae
...
@@ -248,10 +248,8 @@ def test_record_generation():
...
@@ -248,10 +248,8 @@ def test_record_generation():
def
test_variable_deletion_problems
():
def
test_variable_deletion_problems
():
debug_tree
=
DebugTree
()
records
=
scan_directory
(
UNITTESTDIR
/
"
test_directories
"
/
"
example_variable_deletion
"
,
records
=
scan_directory
(
UNITTESTDIR
/
"
test_directories
"
/
"
example_variable_deletion
"
,
UNITTESTDIR
/
"
cfood_variable_deletion.yml
"
,
UNITTESTDIR
/
"
cfood_variable_deletion.yml
"
)
debug_tree
=
debug_tree
)
for
record
in
records
:
for
record
in
records
:
if
record
.
name
==
"
Record from Data_1
"
:
if
record
.
name
==
"
Record from Data_1
"
:
...
@@ -262,3 +260,16 @@ def test_variable_deletion_problems():
...
@@ -262,3 +260,16 @@ def test_variable_deletion_problems():
assert
record
.
get_property
(
"
var2
"
).
value
==
"
test
"
assert
record
.
get_property
(
"
var2
"
).
value
==
"
test
"
else
:
else
:
raise
RuntimeError
(
"
Wrong name
"
)
raise
RuntimeError
(
"
Wrong name
"
)
records
=
scan_directory
(
UNITTESTDIR
/
"
test_directories
"
/
"
example_variable_deletion
"
,
UNITTESTDIR
/
"
cfood_variable_deletion2.yml
"
)
for
record
in
records
:
if
record
.
name
==
"
Record from Data_1
"
:
assert
record
.
get_property
(
"
var1
"
).
value
==
"
bla
"
assert
record
.
get_property
(
"
var2
"
).
value
==
"
$test_2
"
elif
record
.
name
==
"
Record from Data_2
"
:
assert
record
.
get_property
(
"
var1
"
).
value
==
"
example_variable_deletion
"
assert
record
.
get_property
(
"
var2
"
).
value
==
"
test
"
else
:
raise
RuntimeError
(
"
Wrong name
"
)
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