Skip to content

Commit

Permalink
- add hash_port.py and document this
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeek committed Jun 6, 2016
1 parent f367bdf commit 5dce2a9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
recursive-include docs *.html *.css *.txt *.js *.jpg *.png *.py Makefile *.rst *.sty
recursive-include tests *.py *.dat

include README* LICENSE CHANGES* log_tests.ini tox.ini
include README* LICENSE CHANGES* log_tests.ini tox.ini hash_port.py

prune docs/build/output

Expand Down
21 changes: 21 additions & 0 deletions hash_port.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
"""Helper script which provides an integer
number from a given range based on a hash of
current directory name.
This is used in continuous integration as a helper
to provide ports to assign to services like
Redis, Memcached when they are run on a per-test basis.
E.g. in a Jenkins job, one could put as the run command::
export TOX_DOGPILE_PORT=`python hash_port.py 10000 34000`
tox -r -e ${pyv}-${backend}
So you'd get one TOX_DOGPILE_PORT for the script in
/var/lib/jenkins-workspace/py27-redis, another TOX_DOGPILE_PORT
for the script in /var/lib/jenkins-workspace/py34-memcached.
tox calls the pifpaf tool to run redis/ memcached local to that
build and has it listen on this port.
"""
import os
import sys

Expand Down

0 comments on commit 5dce2a9

Please sign in to comment.