forked from tox-dev/tox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`subprocess` reports a negative exit code for signals (the assumption in tox-dev#760 (comment) was wrong). TODO: - [ ] faster test (takes >3s)
- Loading branch information
Showing
3 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import subprocess | ||
import sys | ||
|
||
from tox._pytestplugin import create_files | ||
|
||
|
||
def test_exit_code_signal(cmd, tmpdir): | ||
create_files(tmpdir, { | ||
# TODO: can this be minified? | ||
"tox.ini": """\ | ||
[tox] | ||
skipsdist = true | ||
skips_install = true | ||
[testenv] | ||
commands = {interpreter} tfile.py | ||
""".format( | ||
interpreter=sys.executable | ||
), | ||
"tfile.py": """\ | ||
import os, signal | ||
os.kill(os.getpid(), signal.SIGTERM) | ||
""", | ||
}) | ||
p = subprocess.Popen([ | ||
sys.executable, '-m', 'tox' | ||
], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=str(tmpdir)) | ||
p.wait() | ||
out = p.stdout.read().decode() | ||
assert p.returncode == 1 | ||
assert ( | ||
"ERROR: InvocationError for command {} tfile.py (exited with code -15 (SIGTERM))".format( | ||
sys.executable | ||
) | ||
in out | ||
) | ||
assert p.stderr.read() == b"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters