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
Bliss
bliss
Commits
3004d950
Commit
3004d950
authored
Oct 29, 2020
by
Valentin Valls
Browse files
Wait until flint is terminated
parent
eb84f9f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
bliss/flint/client/proxy.py
View file @
3004d950
...
...
@@ -92,19 +92,30 @@ class FlintClient:
def
close_proxy
(
self
):
if
self
.
_proxy
is
not
None
:
self
.
_proxy
.
close
()
if
self
.
_callbacks
is
not
None
:
stdout_callback
,
stderr_callback
=
self
.
_callbacks
event
.
disconnect
(
self
.
_proxy
,
"flint_stdout"
,
stdout_callback
)
event
.
disconnect
(
self
.
_proxy
,
"flint_stderr"
,
stderr_callback
)
self
.
_callbacks
=
None
self
.
_proxy
=
None
self
.
_pid
=
None
self
.
_process
=
None
if
self
.
_greenlets
is
not
None
:
gevent
.
killall
(
self
.
_greenlets
)
gevent
.
killall
(
self
.
_greenlets
,
timeout
=
2.0
)
self
.
_greenlets
=
None
self
.
_callbacks
=
None
def
close
(
self
):
"""Close Flint and clean up this proxy."""
if
self
.
_proxy
is
None
:
raise
RuntimeError
(
"No proxy connected"
)
self
.
_proxy
.
close_application
()
try
:
p
=
psutil
.
Process
(
self
.
_pid
)
except
psutil
.
NoSuchProcess
:
# process already closed
pass
else
:
psutil
.
wait_procs
([
p
],
timeout
=
4.0
)
self
.
close_proxy
()
def
focus
(
self
):
...
...
tests/conftest.py
View file @
3004d950
...
...
@@ -561,13 +561,13 @@ def flint_context(with_flint=True):
else
:
flint
=
plot
.
get_flint
(
creation_allowed
=
False
)
if
flint
is
not
None
:
flint
.
close
_application
()
flint
.
close
()
flint
=
None
# Break the reference to the proxy
plot
.
reset_flint
()
yield
flint
=
plot
.
get_flint
(
creation_allowed
=
False
)
if
flint
is
not
None
:
flint
.
close
_application
()
flint
.
close
()
flint
=
None
# Break the reference to the proxy
plot
.
reset_flint
()
...
...
tests/shell/test_standard.py
View file @
3004d950
...
...
@@ -303,8 +303,6 @@ def test_open_close_flint(test_session_without_flint):
pid
=
f
.
pid
assert
psutil
.
pid_exists
(
pid
)
f
.
close
()
process
=
psutil
.
Process
(
pid
)
psutil
.
wait_procs
([
process
],
timeout
=
5
)
assert
not
psutil
.
pid_exists
(
pid
)
...
...
@@ -314,8 +312,12 @@ def test_open_kill_flint(test_session_without_flint):
pid
=
f
.
pid
assert
psutil
.
pid_exists
(
pid
)
f
.
kill9
()
process
=
psutil
.
Process
(
pid
)
psutil
.
wait_procs
([
process
],
timeout
=
1
)
try
:
process
=
psutil
.
Process
(
pid
)
except
psutil
.
NoSuchProcess
:
pass
else
:
psutil
.
wait_procs
([
process
],
timeout
=
1
)
assert
not
psutil
.
pid_exists
(
pid
)
...
...
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