Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
ff896d2e
Commit
ff896d2e
authored
Oct 19, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proctitle
parent
574aafdb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
7 deletions
+58
-7
erp5/tests/testProcessManager.py
erp5/tests/testProcessManager.py
+51
-0
setup.py
setup.py
+7
-7
No files found.
erp5/tests/testProcessManager.py
0 → 100644
View file @
ff896d2e
import
os
import
shutil
import
subprocess
import
tempfile
import
unittest
import
sys
import
time
from
erp5.util.testnode.ProcessManager
import
ProcessManager
class
TestProcessManagerKillAll
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
path
=
tempfile
.
mkdtemp
()
self
.
addCleanup
(
shutil
.
rmtree
,
self
.
path
)
self
.
script
=
os
.
path
.
join
(
self
.
path
,
'script'
)
with
open
(
self
.
script
,
'w'
)
as
f
:
f
.
write
(
'#!/bin/sh
\
n
sleep 30'
)
os
.
chmod
(
self
.
script
,
0o700
)
self
.
pm
=
ProcessManager
()
self
.
start_time
=
time
.
time
()
def
tearDown
(
self
):
self
.
assertLess
(
time
.
time
()
-
self
.
start_time
,
29
)
def
test_killall_script_in_path
(
self
):
process
=
subprocess
.
Popen
([
self
.
script
])
self
.
pm
.
killall
(
self
.
path
)
process
.
communicate
()
self
.
assertTrue
(
process
.
poll
())
def
test_killall_another_path
(
self
):
process
=
subprocess
.
Popen
([
self
.
script
])
self
.
pm
.
killall
(
"another path"
)
self
.
assertIsNone
(
process
.
poll
())
process
.
kill
()
process
.
communicate
()
process
.
wait
()
def
test_killall_proctitle
(
self
):
with
open
(
self
.
script
,
'w'
)
as
f
:
f
.
write
(
'''if 1:
import setproctitle
'''
)
process
=
subprocess
.
Popen
([
sys
.
executable
,
self
.
script
])
self
.
pm
.
killall
(
"another path"
)
self
.
assertIsNone
(
process
.
poll
())
process
.
kill
()
process
.
communicate
()
process
.
wait
()
setup.py
View file @
ff896d2e
...
...
@@ -57,6 +57,13 @@ setup(name=name,
'benchmark'
:
benchmark_install_require_list
,
'benchmark-report'
:
[
name
+
'[benchmark]'
,
'matplotlib'
,
'numpy'
],
'zodbanalyse'
:
[
'ZODB'
],
'test'
:
[
'mock; python_version < "3"'
,
'psutil >= 0.5.0'
,
'setproctitle'
,
'slapos.core'
,
'xml_marshaller'
,
]
},
zip_safe
=
True
,
packages
=
package_list
,
...
...
@@ -75,13 +82,6 @@ setup(name=name,
'web_checker_utility = erp5.util.webchecker:web_checker_utility'
],
},
test_suite
=
'erp5.tests'
,
tests_require
=
[
'slapos.core'
,
'xml_marshaller'
,
'psutil >= 0.5.0'
,
'mock; python_version < "3"'
,
],
)
# cleanup garbage
...
...
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