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
475a663c
Commit
475a663c
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: remove another rfp and debugging output
parent
eb50f875
No related branches found
No related tags found
2 merge requests
!123
REL: Release v0.6.0
,
!113
F refactor test tool
Pipeline
#36641
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/basic_example/test_basic.py
+22
-26
22 additions, 26 deletions
integrationtests/basic_example/test_basic.py
unittests/test_table_converter.py
+0
-4
0 additions, 4 deletions
unittests/test_table_converter.py
with
22 additions
and
30 deletions
integrationtests/basic_example/test_basic.py
+
22
−
26
View file @
475a663c
...
...
@@ -26,38 +26,35 @@
an integration test module that does basic integration tests
"""
from
caosadvancedtools.crawler
import
Crawler
as
OldCrawler
from
caoscrawler.debug_tree
import
DebugTree
import
os
from
caosdb
import
EmptyUniqueQueryError
import
argparse
import
os
import
sys
from
argparse
import
RawTextHelpFormatter
from
pathlib
import
Path
import
caosdb
as
db
import
pytest
import
yaml
from
caosadvancedtools.crawler
import
Crawler
as
OldCrawler
from
caosadvancedtools.models.parser
import
parse_model_from_yaml
from
caoscrawler
import
Crawler
,
SecurityMode
from
caoscrawler.debug_tree
import
DebugTree
from
caoscrawler.identifiable
import
Identifiable
import
caosdb
as
db
from
caoscrawler.identifiable_adapters
import
CaosDBIdentifiableAdapter
from
caoscrawler.scanner
import
scan_directory
import
pytest
from
caosadvancedtools.models.parser
import
parse_model_from_yaml
import
yaml
from
caosdb
import
EmptyUniqueQueryError
from
caosdb.utils.register_tests
import
clear_database
,
set_test_key
set_test_key
(
"
10b128cf8a1372f30aa3697466bb55e76974e0c16a599bb44ace88f19c8f61e2
"
)
#TODO move test related stuff here and remove it from unittests
#
TODO move test related stuff here and remove it from unittests
def
rfp
(
*
pathcomponents
):
"""
Return full path.
Shorthand convenience function.
"""
return
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
pathcomponents
)
UNITTESTDIR
=
Path
(
__file__
).
parent
.
parent
.
parent
/
"
unittests
"
@pytest.fixture
def
usemodel
():
model
=
parse_model_from_yaml
(
rfp
(
"
model.yml
"
)
)
model
=
parse_model_from_yaml
(
UNITTESTDIR
/
"
model.yml
"
)
model
.
sync_data_model
(
noquestion
=
True
,
verbose
=
False
)
...
...
@@ -88,8 +85,8 @@ def ident():
def
crawl_standard_test_directory
(
subdir
:
str
=
"
examples_article
"
,
cfood
:
str
=
"
scifolder_cfood.yml
"
,
debug_tree
=
None
):
return
scan_directory
(
rfp
(
"
..
"
,
"
..
"
,
"
unittests
"
,
"
test_directories
"
,
subdir
)
,
rfp
(
"
..
"
,
"
..
"
,
"
unittests
"
,
cfood
)
,
return
scan_directory
(
UNITTESTDIR
/
"
test_directories
"
/
subdir
,
UNITTESTDIR
/
cfood
,
debug_tree
=
debug_tree
)
...
...
@@ -110,7 +107,7 @@ def crawler_extended(ident):
# correct paths for current working directory
file_list
=
[
r
for
r
in
crawled_data
if
r
.
role
==
"
File
"
]
for
f
in
file_list
:
f
.
file
=
rfp
(
"
..
"
,
"
..
"
,
"
unittests
"
,
"
test_directories
"
,
f
.
file
)
f
.
file
=
UNITTESTDIR
/
"
test_directories
"
/
f
.
file
return
cr
,
crawled_data
,
debug_tree
...
...
@@ -132,7 +129,7 @@ def test_single_insertion(clear_database, usemodel, crawler, ident):
if
res
[
i
].
parents
[
0
].
name
==
"
PyTestInfo
"
:
del
res
[
i
]
# uncomment this to recreate the `records.xml` file
# filename =
rfp("..", "..", "unittests",
"records.xml"
)
# filename =
UNITTESTDIR/
"records.xml"
# with open(filename, "w") as f:
# xml = res.to_xml()
# # Remove noscript and transaction benchmark:
...
...
@@ -146,8 +143,8 @@ def test_single_insertion(clear_database, usemodel, crawler, ident):
# Do a second run on the same data, there should be no changes:
crawler
=
Crawler
(
identifiableAdapter
=
ident
)
crawled_data
=
scan_directory
(
rfp
(
"
../../unittests/
test_directories
"
,
"
examples_article
"
)
,
rfp
(
"
../../unittests/
scifolder_cfood.yml
"
)
)
crawled_data
=
scan_directory
(
UNITTESTDIR
/
"
test_directories
"
,
"
examples_article
"
,
UNITTESTDIR
/
"
scifolder_cfood.yml
"
)
ins
,
ups
=
crawler
.
synchronize
(
crawled_data
=
crawled_data
)
assert
len
(
ins
)
==
0
assert
len
(
ups
)
==
0
...
...
@@ -215,7 +212,6 @@ def test_insertion_and_update(clear_database, usemodel, ident, crawler):
cr
=
Crawler
(
identifiableAdapter
=
ident
)
crawled_data
=
crawl_standard_test_directory
(
"
example_overwrite_1
"
)
# cr.save_debug_data(rfp("provenance.yml"))
assert
len
(
crawled_data
)
==
3
ins
,
ups
=
cr
.
synchronize
(
crawled_data
=
crawled_data
)
assert
len
(
ins
)
==
0
...
...
@@ -318,7 +314,7 @@ def test_file_update(clear_database, usemodel, ident, crawler_extended):
file_list
=
[
r
for
r
in
crawled_data
if
r
.
role
==
"
File
"
]
for
f
in
file_list
:
f
.
file
=
rfp
(
"
..
"
,
"
..
"
,
"
unittests
"
,
"
test_directories
"
,
f
.
file
)
f
.
file
=
UNITTESTDIR
/
"
test_directories
"
,
f
.
file
ins2
,
ups2
=
cr
.
synchronize
(
crawled_data
=
crawled_data
,
commit_changes
=
True
)
assert
len
(
ups1
)
==
0
assert
len
(
ups2
)
==
0
...
...
@@ -333,7 +329,7 @@ def test_file_update(clear_database, usemodel, ident, crawler_extended):
file_list
=
[
r
for
r
in
crawled_data
if
r
.
role
==
"
File
"
]
for
f
in
file_list
:
f
.
file
=
rfp
(
"
..
"
,
"
..
"
,
"
unittests
"
,
"
test_directories
"
,
f
.
file
)
f
.
file
=
UNITTESTDIR
/
"
test_directories
"
,
f
.
file
ins3
,
ups3
=
cr2
.
synchronize
(
crawled_data
=
crawled_data
,
commit_changes
=
True
)
assert
len
(
ups3
)
==
11
...
...
This diff is collapsed.
Click to expand it.
unittests/test_table_converter.py
+
0
−
4
View file @
475a663c
...
...
@@ -146,10 +146,6 @@ def test_crawl_csv_table():
rfp
(
"
test_directories
"
,
"
examples_tables
"
,
"
crawler_for_tables.yml
"
),
debug_tree
=
dbt
)
for
file_ext
in
[
"
xlsx
"
,
"
csv
"
]:
print
(
dbt
.
debug_tree
)
print
(
dircheckstr
(
UNITTESTDIR
/
"
test_directories
"
/
"
examples_tables
"
/
"
ExperimentalData
"
,
"
test1.
"
+
file_ext
))
subd
=
dbt
.
debug_tree
[
dircheckstr
(
UNITTESTDIR
/
"
test_directories
"
/
"
examples_tables
"
/
"
ExperimentalData
"
,
"
test1.
"
+
file_ext
)]
...
...
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