Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
funpack
Commits
07f6b70c
Commit
07f6b70c
authored
Jan 04, 2022
by
Paul McCarthy
🚵
Browse files
TEST: make sure entry points exist and are on $PATH
parent
a2611afc
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
funpack/tests/test_demo.py
View file @
07f6b70c
...
@@ -57,18 +57,16 @@ def test_demo():
...
@@ -57,18 +57,16 @@ def test_demo():
assert
not
nbproc
.
is_alive
()
assert
not
nbproc
.
is_alive
()
def
test_demo_commands
():
def
create_funpack_entrypoint
(
path
):
with
open
(
path
,
'wt'
)
as
f
:
f
.
write
(
'#!/usr/bin/env bash
\n
'
)
f
.
write
(
'{} -m funpack "$@"
\n
'
.
format
(
sys
.
executable
))
os
.
chmod
(
path
,
0o755
)
# Issues with pytest-cov 3.0.0 / coveragepy 6.2
# cause coverage to spit out error information
# in subprocess-called invocations. Disabling for
# the time being.
env
=
os
.
environ
.
copy
()
for
k
in
list
(
env
.
keys
()):
if
'COVERAGE'
in
k
or
k
.
startswith
(
'COV_'
):
env
.
pop
(
k
)
def
eval_cmd
(
cmd
,
out
):
def
test_demo_commands
():
def
eval_cmd
(
cmd
,
out
,
env
):
# TODO extract all funpack calls, and turn
# TODO extract all funpack calls, and turn
# them into funpack.main function calls.
# them into funpack.main function calls.
...
@@ -79,9 +77,23 @@ def test_demo_commands():
...
@@ -79,9 +77,23 @@ def test_demo_commands():
assert
result
.
returncode
==
0
assert
result
.
returncode
==
0
assert
result
.
stdout
.
decode
().
strip
()
==
out
.
strip
()
assert
result
.
stdout
.
decode
().
strip
()
==
out
.
strip
()
# Issues with pytest-cov 3.0.0 / coveragepy 6.2
# cause coverage to spit out error information
# in subprocess-called invocations. Disabling for
# the time being.
env
=
os
.
environ
.
copy
()
for
k
in
list
(
env
.
keys
()):
if
'COVERAGE'
in
k
or
k
.
startswith
(
'COV_'
):
env
.
pop
(
k
)
with
tempdir
()
as
td
:
with
tempdir
()
as
td
:
td
=
op
.
realpath
(
td
)
td
=
op
.
realpath
(
td
)
gen_demo_tests
(
rundir
=
td
)
gen_demo_tests
(
rundir
=
td
)
create_funpack_entrypoint
(
op
.
join
(
td
,
'funpack'
))
create_funpack_entrypoint
(
op
.
join
(
td
,
'fmrib_unpack'
))
env
[
'PATH'
]
=
op
.
pathsep
.
join
((
td
,
env
[
'PATH'
]))
demodir
=
op
.
join
(
op
.
dirname
(
__file__
),
'..'
,
'scripts'
,
'demo'
)
demodir
=
op
.
join
(
op
.
dirname
(
__file__
),
'..'
,
'scripts'
,
'demo'
)
for
fname
in
glob
.
glob
(
op
.
join
(
demodir
,
'*.*'
)):
for
fname
in
glob
.
glob
(
op
.
join
(
demodir
,
'*.*'
)):
...
@@ -96,7 +108,7 @@ def test_demo_commands():
...
@@ -96,7 +108,7 @@ def test_demo_commands():
print
(
open
(
cmd
).
read
())
print
(
open
(
cmd
).
read
())
print
()
print
()
eval_cmd
(
cmd
,
out
)
eval_cmd
(
cmd
,
out
,
env
)
def
gen_demo_tests
(
outdir
=
None
,
rundir
=
None
):
def
gen_demo_tests
(
outdir
=
None
,
rundir
=
None
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment