summaryrefslogtreecommitdiff
path: root/tests/__init__.py
diff options
context:
space:
mode:
authorSergey Shepelev <temotor@gmail.com>2016-11-05 19:28:14 +0300
committerSergey Shepelev <temotor@gmail.com>2016-11-05 22:43:35 +0300
commit4872be77001bde7b393f8973779a15c65ce36086 (patch)
treed6b2fecc438a9134dc2ec652b34231dee958630e /tests/__init__.py
parentdf0d300e7e60661b80346f31815e5266bb302c57 (diff)
downloadeventlet-4872be77001bde7b393f8973779a15c65ce36086.tar.gz
tests: str/bytes typo on run_python timeout
Diffstat (limited to 'tests/__init__.py')
-rw-r--r--tests/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index b9e0add..6ff6d2a 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -306,8 +306,6 @@ def run_python(path, env=None, args=None, timeout=None):
new_argv = [sys.executable]
new_env = os.environ.copy()
if path:
- if not path.endswith('.py'):
- path += '.py'
path = os.path.abspath(path)
new_argv.append(path)
src_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -330,7 +328,7 @@ def run_python(path, env=None, args=None, timeout=None):
except subprocess.TimeoutExpired:
p.kill()
output, _ = p.communicate(timeout=timeout)
- return "{0}\nFAIL - timed out".format(output)
+ return '{0}\nFAIL - timed out'.format(output).encode()
return output
@@ -350,3 +348,8 @@ def run_isolated(path, prefix='tests/isolated/', env=None, args=None, timeout=No
certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')
+
+
+def test_run_python_timeout():
+ output = run_python('', args=('-c', 'import time; time.sleep(0.5)'), timeout=0.1)
+ assert output.endswith(b'FAIL - timed out')