Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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-advanced-user-tools
Commits
f898e5ef
Commit
f898e5ef
authored
4 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
STY: ws changes
parent
0f2533f4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!59
FIX: if multiple updates for one entity exist, the retrieve would result in an...
,
!46
F cache version
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_cache.py
+7
-7
7 additions, 7 deletions
unittests/test_cache.py
with
7 additions
and
7 deletions
unittests/test_cache.py
+
7
−
7
View file @
f898e5ef
...
...
@@ -75,7 +75,7 @@ class CacheTest(unittest.TestCase):
# TODO: is that wanted?
self
.
assertEqual
(
ent
.
id
,
-
1
)
self
.
assertEqual
(
ent3
.
id
,
-
1
)
# TODO: I expected this instead:
# with pytest.raises(RuntimeError, match=r".*no ID.*"):
# self.cache.insert_list(hashes, entities)
...
...
@@ -94,6 +94,7 @@ class CacheTest(unittest.TestCase):
self
.
assertEqual
(
self
.
cache
.
check_existing
(
hashes
[
0
])[
0
],
1001
)
self
.
assertEqual
(
self
.
cache
.
check_existing
(
hashes
[
2
])[
0
],
1003
)
def
create_sqlite_file
(
commands
):
"""
A temporary file will be used
...
...
@@ -108,12 +109,13 @@ def create_sqlite_file(commands):
conn
.
commit
()
conn
.
close
()
return
db_file
class
CacheTest2
(
unittest
.
TestCase
):
"""
Test the schema version.
"""
def
setUp
(
self
):
# Correct version:
self
.
cache
=
Cache
(
db_file
=
NamedTemporaryFile
(
delete
=
False
).
name
,
...
...
@@ -144,8 +146,6 @@ class CacheTest2(unittest.TestCase):
(
'''
CREATE TABLE version (schema INTEGER)
'''
,),
(
"
INSERT INTO version VALUES (?)
"
,
(
1
,)),
(
"
INSERT INTO version VALUES (?)
"
,
(
3
,))])])
def
test_schema
(
self
):
# Test whether new cache is created correctly:
...
...
@@ -175,11 +175,12 @@ class CacheTest2(unittest.TestCase):
for
db_fn_defect
in
self
.
db_file_defect
:
os
.
remove
(
db_fn_defect
)
class
InvalidationTest
(
unittest
.
TestCase
):
"""
Test invalidation of cache entries.
"""
def
setUp
(
self
):
# Correct version:
self
.
cache
=
Cache
(
db_file
=
NamedTemporaryFile
(
delete
=
False
).
name
,
...
...
@@ -188,7 +189,6 @@ class InvalidationTest(unittest.TestCase):
def
tearDown
(
self
):
os
.
remove
(
self
.
cache
.
db_file
)
def
test_invalid
(
self
):
ent
=
db
.
Record
()
ent2
=
db
.
Record
()
...
...
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