Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nxdtest
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
nxdtest
Commits
f8cb460a
Commit
f8cb460a
authored
Dec 10, 2021
by
Jérome Perrin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip test to confirm terminating nxdtest terminates running test program
parent
2fdb6067
Pipeline
#18740
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
nxdtest/nxdtest_test.py
nxdtest/nxdtest_test.py
+31
-3
No files found.
nxdtest/nxdtest_test.py
View file @
f8cb460a
...
...
@@ -19,17 +19,19 @@
# verify general functionality
import
subprocess
import
sys
import
re
import
signal
import
time
from
os.path
import
dirname
from
os.path
import
dirname
,
exists
from
golang
import
chan
,
select
,
default
,
func
,
defer
from
golang
import
context
,
sync
import
psutil
import
pytest
from
nxdtest
import
main
import
nxdtest
@
pytest
.
fixture
...
...
@@ -46,7 +48,7 @@ def run_nxdtest(tmpdir):
sys_argv
=
sys
.
argv
sys
.
argv
=
argv
try
:
main
()
nxdtest
.
main
()
finally
:
sys
.
argv
=
sys_argv
...
...
@@ -230,3 +232,29 @@ TestCase('TEST1', ['%s', '%s'])
with
open
(
pidfile
)
as
f
:
pid
=
int
(
f
.
read
())
assert
not
psutil
.
pid_exists
(
pid
)
@
pytest
.
mark
.
timeout
(
timeout
=
10
)
@
pytest
.
mark
.
parametrize
(
'signal_number'
,
[
signal
.
SIGINT
,
signal
.
SIGTERM
])
def
test_interrupted_test
(
run_nxdtest
,
capsys
,
tmp_path
,
tmpdir
,
signal_number
):
slow
=
"%s/testprog/slow"
%
(
dirname
(
__file__
),)
pidfile
=
str
(
tmp_path
/
'slow.pid'
)
with
tmpdir
.
as_cwd
():
with
open
(
'.nxdtest'
,
'w'
)
as
f
:
f
.
write
(
"""
\
TestCase('TEST1', ['%s', '%s'])
"""
%
(
slow
,
pidfile
))
nxdtest_process
=
subprocess
.
Popen
([
sys
.
executable
,
'%s/__init__.py'
%
dirname
(
nxdtest
.
__file__
)])
# wait for process to start
for
_
in
range
(
10
):
if
exists
(
pidfile
):
break
time
.
sleep
(.
5
)
nxdtest_process
.
send_signal
(
signal_number
)
nxdtest_process
.
wait
()
with
open
(
pidfile
)
as
f
:
pid
=
int
(
f
.
read
())
assert
not
psutil
.
pid_exists
(
pid
)
Jérome Perrin
@jerome
mentioned in merge request
nexedi/nxdtest!14 (merged)
·
Dec 10, 2021
mentioned in merge request
nexedi/nxdtest!14 (merged)
mentioned in merge request nexedi/nxdtest!14
Toggle commit list
Write
Preview
Markdown
is supported
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