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
a43e934a
Commit
a43e934a
authored
Nov 28, 2019
by
Paul McCarthy
🚵
Browse files
TEST: notebook is difficult to kill
parent
fb3f4934
Changes
1
Hide whitespace changes
Inline
Side-by-side
funpack/tests/test_demo.py
View file @
a43e934a
...
...
@@ -12,6 +12,7 @@ import glob
import
shutil
import
sys
import
os
import
signal
import
os.path
as
op
import
itertools
as
it
import
subprocess
as
sp
...
...
@@ -31,20 +32,29 @@ from . import tempdir
def
test_demo
():
def
shutdown
():
time
.
sleep
(
3
)
with
mock
.
patch
(
'os.kill'
):
for
server
in
notebookapp
.
list_running_servers
():
notebookapp
.
shutdown_server
(
server
)
def
nbfunc
():
# add some extra args for running within docker
if
op
.
exists
(
'/.dockerenv'
):
args
=
[
'--allow-root'
,
'--ip=0.0.0.0'
]
else
:
args
=
None
mp
.
Process
(
target
=
shutdown
).
start
()
with
mock
.
patch
(
'sys.argv'
,
[
'funpack_demo'
]):
ukbdemo
.
main
(
args
)
# add some extra args for running within docker
if
op
.
exists
(
'/.dockerenv'
):
args
=
[
'--allow-root'
,
'--ip=0.0.0.0'
]
else
:
args
=
None
nbproc
=
mp
.
Process
(
target
=
nbfunc
)
nbproc
.
start
()
time
.
sleep
(
3
)
with
mock
.
patch
(
'sys.argv'
,
[
'funpack_demo'
]):
ukbdemo
.
main
(
args
)
servers
=
notebookapp
.
list_running_servers
()
assert
sum
([
s
[
'pid'
]
==
nbproc
.
pid
for
s
in
servers
])
==
1
for
s
in
servers
:
if
s
[
'pid'
]
==
nbproc
.
pid
:
notebookapp
.
shutdown_server
(
s
)
break
os
.
kill
(
nbproc
.
pid
,
signal
.
SIGKILL
)
nbproc
.
join
(
0.5
)
assert
not
nbproc
.
is_alive
()
def
test_demo_commands
():
...
...
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