Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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 Python Integration Tests
Commits
b5c99d4e
Commit
b5c99d4e
authored
3 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into f-local-inttests
parents
c22de587
d362a52a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!81
F local inttests
Pipeline
#60040
passed
3 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
tests/test_issues_pylib.py
+42
-0
42 additions, 0 deletions
tests/test_issues_pylib.py
tests/test_misc.py
+6
-6
6 additions, 6 deletions
tests/test_misc.py
with
49 additions
and
6 deletions
CHANGELOG.md
+
1
−
0
View file @
b5c99d4e
...
...
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added (for new features)
*
Tests for
[
linkahead-pylib#127
](
https://gitlab.com/linkahead/linkahead-pylib/-/issues/127
)
*
Tests for
[
linkahead-server#280
](
https://gitlab.com/linkahead/linkahead-server/-/issues/280
)
*
Test for
[
caosdb-pylib#119
](
https://gitlab.com/linkahead/linkahead-pylib/-/issues/119
)
*
Test for
[
caosdb-pylib#89
](
https://gitlab.com/linkahead/linkahead-pylib/-/issues/89
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_issues_pylib.py
+
42
−
0
View file @
b5c99d4e
...
...
@@ -29,6 +29,7 @@ import os
import
tempfile
import
time
import
warnings
from
pathlib
import
Path
import
linkahead
as
db
import
linkahead.common.utils
...
...
@@ -196,3 +197,44 @@ def test_gitlab_com_120():
rt1_retrieved
.
update
()
# The update and addition of a new property must not change this, either.
assert
len
(
rt1_retrieved
.
get_property
(
rt2
.
name
).
properties
)
==
0
def
test_gitlab_com_127
():
"""
Test that the timeout option in pylinkahead.ini accepts separate
connect/read timeouts and timeout None.
See https://gitlab.com/linkahead/linkahead-pylib/-/issues/127 and
https://gitlab.indiscale.com/caosdb/customers/f-fit/management/-/issues/93
"""
# Setup paths and save previous timeout
base_dir
=
Path
(
__file__
).
parent
.
parent
temp_pylinkahead_path
=
base_dir
/
'
.pyla-temp-test.ini
'
temp_pylinkahead_path
.
unlink
(
True
)
prev_timeout
=
None
if
db
.
get_config
().
has_option
(
'
Connection
'
,
'
timeout
'
):
prev_timeout
=
db
.
get_config
().
get
(
'
Connection
'
,
'
timeout
'
)
# Parse various timeout strings and check successful connect
valid_timeout_strings
=
[
"
timeout = None
"
,
"
timeout=null
"
,
"
timeout = (4, 40)
"
,
"
timeout=(4,4)
"
,
"
timeout = (4, None)
"
,
"
timeout= ( null , 4 )
"
]
for
timeout_string
in
valid_timeout_strings
:
try
:
# Create temporary config with timeout option
with
open
(
temp_pylinkahead_path
,
"
x
"
)
as
temp_pylinkahead
:
temp_pylinkahead
.
write
(
'
[Connection]
\n
'
)
temp_pylinkahead
.
write
(
timeout_string
)
# Parse temporary config and check successful connect
db
.
get_config
().
read
(
str
(
temp_pylinkahead_path
))
db
.
configure_connection
()
assert
'
Connection to
'
in
str
(
db
.
Info
())
finally
:
# Delete temporary config
temp_pylinkahead_path
.
unlink
()
# Reset configuration
db
.
get_config
().
remove_option
(
'
Connection
'
,
'
timeout
'
)
if
prev_timeout
is
not
None
:
db
.
get_config
().
set
(
'
Connection
'
,
'
timeout
'
,
prev_timeout
)
db
.
configure_connection
()
This diff is collapsed.
Click to expand it.
tests/test_misc.py
+
6
−
6
View file @
b5c99d4e
...
...
@@ -499,12 +499,12 @@ def test_retrieve_wrong_role(clear_database):
assert
entity
.
role
==
"
Record
"
with
raises
(
ValueError
)
as
cm
:
entity
.
retrieve
()
assert
cm
.
value
.
args
[
0
]
==
(
"
The resulting entity had a different role
"
"
(RecordType) than the local one (Record).
"
"
This probably means, that the entity was
"
"
intialized with a wrong class by this client
"
"
or it has changed in the past and this
"
"
client did
'
t know about it yet.
"
)
assert
cm
.
value
.
args
[
0
]
.
startswith
(
"
The resulting entity had a different role
"
"
(RecordType) than the local one (Record).
"
"
This probably means, that the entity was
"
"
intialized with a wrong class by this client
"
"
or it has changed in the past and this
"
"
client did
'
t know about it yet.
"
)
@fixture
...
...
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