Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
Michiel Cottaar
fslpy
Commits
e940d19a
Commit
e940d19a
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: test that assertions are disabled with cmdonly=True
parent
3ebae6b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_wrappers/test_wrapperutils.py
+18
-1
18 additions, 1 deletion
tests/test_wrappers/test_wrapperutils.py
with
18 additions
and
1 deletion
tests/test_wrappers/test_wrapperutils.py
+
18
−
1
View file @
e940d19a
...
@@ -22,12 +22,13 @@ import nibabel as nib
...
@@ -22,12 +22,13 @@ import nibabel as nib
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.run
as
run
import
fsl.utils.run
as
run
import
fsl.utils.assertions
as
asrt
import
fsl.utils.fslsub
as
fslsub
import
fsl.utils.fslsub
as
fslsub
import
fsl.data.image
as
fslimage
import
fsl.data.image
as
fslimage
import
fsl.wrappers.wrapperutils
as
wutils
import
fsl.wrappers.wrapperutils
as
wutils
from
..
import
mockFSLDIR
,
cleardir
,
checkdir
,
testdir
from
..
import
mockFSLDIR
,
cleardir
,
checkdir
,
testdir
,
touch
from
..test_run
import
mock_submit
from
..test_run
import
mock_submit
...
@@ -861,3 +862,19 @@ def test_cmdwrapper_fileorthing_cmdonly():
...
@@ -861,3 +862,19 @@ def test_cmdwrapper_fileorthing_cmdonly():
cmd
=
test_func
(
'
1
'
,
'
2
'
,
cmdonly
=
True
)
cmd
=
test_func
(
'
1
'
,
'
2
'
,
cmdonly
=
True
)
assert
ran
.
stdout
[
0
].
strip
()
==
'
test_script running: 1 2
'
assert
ran
.
stdout
[
0
].
strip
()
==
'
test_script running: 1 2
'
assert
cmd
==
[
'
test_script
'
,
'
1
'
,
'
2
'
]
assert
cmd
==
[
'
test_script
'
,
'
1
'
,
'
2
'
]
def
test_cmdwrapper_cmdonly_assert
():
@wutils.cmdwrapper
def
func
():
asrt
.
assertFileExists
(
'
file
'
)
return
[
'
echo
'
,
'
hello
'
]
with
tempdir
.
tempdir
():
with
pytest
.
raises
(
AssertionError
):
func
()
touch
(
'
file
'
)
assert
func
()[
0
].
strip
()
==
'
hello
'
os
.
remove
(
'
file
'
)
assert
func
(
cmdonly
=
True
)
==
[
'
echo
'
,
'
hello
'
]
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