Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD 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
FSL
fslpy
Commits
4c777562
Commit
4c777562
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test cmdonly handling
parent
1a2577d7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_run.py
+7
-0
7 additions, 0 deletions
tests/test_run.py
tests/test_wrappers/test_wrapperutils.py
+7
-2
7 additions, 2 deletions
tests/test_wrappers/test_wrapperutils.py
with
14 additions
and
2 deletions
tests/test_run.py
+
7
−
0
View file @
4c777562
...
...
@@ -179,6 +179,13 @@ def test_run_passthrough():
assert
run
.
run
(
'
./script.sh
'
,
env
=
env
)
==
expstdout
def
test_cmdonly
():
assert
run
.
run
(
'
script.sh
'
,
cmdonly
=
True
)
==
[
'
script.sh
'
]
assert
run
.
run
(
'
script.sh 1 2 3
'
,
cmdonly
=
True
)
==
[
'
script.sh
'
,
'
1
'
,
'
2
'
,
'
3
'
]
assert
run
.
run
([
'
script.sh
'
],
cmdonly
=
True
)
==
[
'
script.sh
'
]
assert
run
.
run
([
'
script.sh
'
,
'
1
'
],
cmdonly
=
True
)
==
[
'
script.sh
'
,
'
1
'
]
def
test_dryrun
():
test_script
=
textwrap
.
dedent
(
"""
...
...
This diff is collapsed.
Click to expand it.
tests/test_wrappers/test_wrapperutils.py
+
7
−
2
View file @
4c777562
...
...
@@ -753,15 +753,20 @@ def test_cmdwrapper():
with
run
.
dryrun
():
assert
func
(
1
,
2
)[
0
]
==
'
func 1 2
'
assert
func
(
1
,
2
,
cmdonly
=
True
)
==
[
'
func
'
,
'
1
'
,
'
2
'
]
def
test_fslwrapper
():
@wutils.fslwrapper
def
func
(
a
,
b
):
return
[
'
func
'
,
str
(
a
),
str
(
b
)]
with
run
.
dryrun
(),
mockFSLDIR
(
bin
=
(
'
func
'
,))
as
fsldir
:
with
mockFSLDIR
(
bin
=
(
'
func
'
,))
as
fsldir
:
expected
=
'
{} 1 2
'
.
format
(
op
.
join
(
fsldir
,
'
bin
'
,
'
func
'
))
assert
func
(
1
,
2
)[
0
]
==
expected
with
run
.
dryrun
():
assert
func
(
1
,
2
)[
0
]
==
expected
func
(
1
,
2
,
cmdonly
=
True
)[
0
]
==
list
(
shlex
.
split
(
expected
))
_test_script
=
textwrap
.
dedent
(
"""
...
...
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