diff options
| author | Tomaz Muraus <tomaz@tomaz.me> | 2014-11-12 17:30:09 +0800 |
|---|---|---|
| committer | Tomaz Muraus <tomaz@tomaz.me> | 2014-11-12 21:17:29 +0800 |
| commit | 6d7633366b14575fd7a56e263e253e066c5cd998 (patch) | |
| tree | 00183cb9109d5ca9e8361482c716b93ae0cfa754 /tests | |
| parent | 2231cabf6caee69b8998f81fefedf8e53b541001 (diff) | |
| download | eventlet-6d7633366b14575fd7a56e263e253e066c5cd998.tar.gz | |
Fix __str__ method on the TimeoutExpired exception class. Also fix argument
order in the class constructor so it uses the same order as the actual class
from Python 3.3 and above.
TimeoutExpired from Python 3.3 takes arguments in the following order:
cmd, timeout, output.
See https://github.com/python/cpython/blob/master/Lib/subprocess.py#L388
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/subprocess_test.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/subprocess_test.py b/tests/subprocess_test.py index 5528bc4..6964a74 100644 --- a/tests/subprocess_test.py +++ b/tests/subprocess_test.py @@ -12,13 +12,16 @@ def test_subprocess_wait(): # In Python 3.3 subprocess.Popen.wait() method acquired `timeout` # argument. # RHEL backported it to their Python 2.6 package. - p = subprocess.Popen( - [sys.executable, "-c", "import time; time.sleep(0.5)"]) + cmd = [sys.executable, "-c", "import time; time.sleep(0.5)"] + p = subprocess.Popen(cmd) ok = False t1 = time.time() try: p.wait(timeout=0.1) - except subprocess.TimeoutExpired: + except subprocess.TimeoutExpired as e: + str(e) # make sure it doesnt throw + assert e.cmd == cmd + assert e.timeout == 0.1 ok = True tdiff = time.time() - t1 assert ok, 'did not raise subprocess.TimeoutExpired' |
