[PATCH 6/6] tox: Use a range of ports for live servers in case of concurrent runs

Damien Lespiau damien.lespiau at intel.com
Wed Sep 23 02:11:49 AEST 2015


In the case where the tests are run by multiple processes in parallel (for
example, in the context of several simultaneous continuous integration builds),
the processes will compete for the same address, and therefore your tests might
randomly fail with an “Address already in use” error.

And indeed it was hapening in my setup:

Traceback (most recent call last):
  line 1193, in setUpClass
      raise cls.server_thread.error
      error: [Errno 98] Address already in use

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
 tox.ini | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index c04825e..e4d54bd 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,7 +14,8 @@ deps =
 setenv =
     DJANGO_SETTINGS_MODULE = patchwork.settings.dev
 commands =
-    {toxinidir}/manage.py test --noinput '{posargs:patchwork}'
+    {toxinidir}/manage.py test --noinput --liveserver=localhost:9000-9200 \
+        '{posargs:patchwork}'
 passenv =
     http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY

More information about the Patchwork mailing list