Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
1f64088b
Commit
1f64088b
authored
4 years ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Add unit test for wait_on_transfer
parent
72e8daf1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!435
Use asyncio subprocess interface in webservice code
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
tests/test_webservice.py
+16
-1
16 additions, 1 deletion
tests/test_webservice.py
with
17 additions
and
2 deletions
.gitlab-ci.yml
+
1
−
1
View file @
1f64088b
...
...
@@ -8,5 +8,5 @@ pytest:
stage
:
test
script
:
-
python3 -m pip install --user -r requirements.txt
-
python3 -m pip install --user pytest
-
python3 -m pip install --user pytest
pytest-asyncio testpath
-
pytest -vv tests/test_*
This diff is collapsed.
Click to expand it.
tests/test_webservice.py
+
16
−
1
View file @
1f64088b
import
sys
from
pathlib
import
Path
from
testpath
import
MockCommand
from
unittest
import
mock
import
pytest
sys
.
path
.
insert
(
0
,
Path
(
__file__
).
parent
/
'
webservice
'
)
from
webservice.webservice
import
check_files
,
merge
,
parse_config
# noqa
from
webservice.webservice
import
(
check_files
,
merge
,
parse_config
,
wait_on_transfer
,
)
def
test_check_files
():
...
...
@@ -63,3 +67,14 @@ def test_parse_config():
with
pytest
.
raises
(
ValueError
):
config
=
{
'
somekey
'
:
'
a value
'
}
config
=
parse_config
(
cmd
,
config
)
@pytest.mark.asyncio
async
def
test_wait_on_transfer
(
tmp_path
):
mock_getfattr
=
MockCommand
(
'
getfattr
'
,
content
=
"""
#!{}
\n
print(
'
user.status=
"
dCache
"'
)
"""
.
format
(
sys
.
executable
)
)
with
mock
.
patch
(
'
asyncio.sleep
'
),
mock_getfattr
:
res
=
await
wait_on_transfer
(
tmp_path
,
max_tries
=
1
)
assert
res
is
True
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