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
3710cf16
"README.md" did not exist on "967230c8aaf7da5f51d284cfc0918662bff733e9"
Commit
3710cf16
authored
3 years ago
by
Cyril Danilevski
Browse files
Options
Downloads
Patches
Plain Diff
Add test for webservice.run_action
parent
d26b8632
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!495
Show clearer messages when running webservice in sim mode
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_webservice.py
+27
-1
27 additions, 1 deletion
tests/test_webservice.py
with
27 additions
and
1 deletion
tests/test_webservice.py
+
27
−
1
View file @
3710cf16
...
...
@@ -6,7 +6,10 @@ import pytest
from
testpath
import
MockCommand
sys
.
path
.
insert
(
0
,
Path
(
__file__
).
parent
/
'
webservice
'
)
from
webservice.webservice
import
check_files
,
merge
,
parse_config
,
wait_on_transfer
import
webservice
# noqa: import not at top of file
from
webservice.webservice
import
(
# noqa: import not at top of file
check_files
,
merge
,
parse_config
,
run_action
,
wait_on_transfer
)
@pytest.mark.requires_gpfs
...
...
@@ -77,3 +80,26 @@ async def test_wait_on_transfer(tmp_path):
with
mock_getfattr
:
res
=
await
wait_on_transfer
(
str
(
tmp_path
),
max_tries
=
1
)
assert
res
is
True
@pytest.mark.asyncio
@pytest.mark.parametrize
(
'
mode, cmd, retcode, expected
'
,
[
(
'
prod
'
,
[
'
CORRECT
'
,
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
],
1
,
"
failed: failed executing
"
),
# noqa
(
'
prod
'
,
[
'
DARK
'
,
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
],
1
,
"
failed: failed executing
"
),
(
'
prod
'
,
[
'
CORRECT
'
,
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
],
0
,
"
success: started correction
"
),
# noqa
(
'
prod
'
,
[
'
DARK
'
,
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
],
0
,
"
success: started dark characterization
"
),
# noqa
(
'
sim
'
,
[
'
CORRECT
'
,
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
],
1
,
"
success: simulated
"
),
(
'
sim
'
,
[
'
DARK
'
,
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
],
1
,
"
success: simulated
"
),
],
)
async
def
test_run_action
(
mode
,
cmd
,
retcode
,
expected
):
job_db
=
mock
.
Mock
()
async
def
mock_run_proc_async
(
*
args
):
return
retcode
,
b
'
Submitted job: 42
'
webservice
.
webservice
.
run_proc_async
=
mock_run_proc_async
ret
=
await
run_action
(
job_db
,
cmd
,
mode
,
1
,
1
,
1
)
assert
ret
.
lower
().
startswith
(
expected
)
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