[tor-commits] [stem/master] Run test_launch_tor_with_timeout in serial
atagar at torproject.org
atagar at torproject.org
Fri Sep 8 17:08:24 UTC 2017
commit 3cc85fc9dbb907965279cca4d844999d57010a2b
Author: Damian Johnson <atagar at torproject.org>
Date: Fri Sep 8 10:08:14 2017 -0700
Run test_launch_tor_with_timeout in serial
Huh. Works on my laptop but on my desktop one of the tests are failing. I
suspect the issue is that running it at the same time we're running others
in parallel starves the test for resources, causing it to take too long.
Test reliability is far more important than a tiny bit of runtime. On its
own this test is pretty quick anyway. :)
======================================================================
FAIL: test_launch_tor_with_timeout
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 150, in <lambda>
self.method = lambda test: self.result(test) # method that can be mixed into TestCases
File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 212, in result
test.fail(self._result.msg)
AssertionError: Test should have taken 0.05-3 seconds, took 3.4 instead
----------------------------------------------------------------------
---
test/integ/process.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/test/integ/process.py b/test/integ/process.py
index dea0b4c3..00929ce1 100644
--- a/test/integ/process.py
+++ b/test/integ/process.py
@@ -45,6 +45,8 @@ PublishServerDescriptor 0
DataDirectory %s
"""
+TOR_CMD = None
+
def random_port():
while True:
@@ -110,9 +112,12 @@ def run_tor(tor_cmd, *args, **kwargs):
class TestProcess(unittest.TestCase):
@staticmethod
def run_tests(args):
+ global TOR_CMD
+ TOR_CMD = args.tor_cmd
+
for func, async_test in stem.util.test_tools.ASYNC_TESTS.items():
if func.startswith('test.integ.process.'):
- async_test.run(args.tor_cmd)
+ async_test.run(TOR_CMD)
@asynchronous
def test_version_argument(tor_cmd):
@@ -535,8 +540,7 @@ class TestProcess(unittest.TestCase):
except OSError as exc:
assert_equal('Process terminated: Failed to bind one of the listener ports.', str(exc))
- @asynchronous
- def test_launch_tor_with_timeout(tor_cmd):
+ def test_launch_tor_with_timeout(self):
"""
Runs launch_tor where it times out before completing.
"""
@@ -546,7 +550,7 @@ class TestProcess(unittest.TestCase):
try:
stem.process.launch_tor_with_config(
- tor_cmd = tor_cmd,
+ tor_cmd = TOR_CMD,
timeout = 0.05,
config = {
'SocksPort': random_port(),
More information about the tor-commits
mailing list