Opened 6 years ago

Closed 5 years ago

#14091 closed enhancement (implemented)

Add tox support for stem

Reported by: Foxboron Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Stem Version:
Severity: Keywords: tox, python, testing
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Diff for getting tox support for stem. It will run
everything over all python versions we want to support.
This will also make it easier to get jenkins to run multiple
python versions.

Note: There is a bug where the script does not return
the proper error code(?) for tox, so it will complain about not being
able to execute the given command if there are errors. This should be
easy to solve tho.

diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..85d85f1
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,5 @@
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..b0876da
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,11 @@
+envlist = py26,py27,py31,py32,py33,py34
+skipsdist = True
+commands =
+ pip install --allow-all-external -e .
+ python -a
+deps =
+ -rrequirements.txt

Child Tickets

Change History (5)

comment:1 Changed 6 years ago by atagar

Hi Foxboron. I'm not really familiar with tox so I gave this a quick whirl. It didn't like me...

ERROR:   py26: InterpreterNotFound: python2.6
ERROR:   py27: could not install deps [-rrequirements.txt]; v = InvocationError('/home/atagar/Desktop/stem/.tox/py27/bin/pip install --pre -rrequirements.txt (see /home/atagar/Desktop/stem/.tox/py27/log/py27-1.log)', 1)
ERROR:   py31: InterpreterNotFound: python3.1
ERROR:   py32: could not install deps [-rrequirements.txt]; v = InvocationError('/home/atagar/Desktop/stem/.tox/py32/bin/pip install --pre -rrequirements.txt (see /home/atagar/Desktop/stem/.tox/py32/log/py32-1.log)', 1)
ERROR:   py33: InterpreterNotFound: python3.3
ERROR:   py34: InterpreterNotFound: python3.4

For python 2.7 and 3.2 the cited logs ended with...

    creating build/temp.linux-i686-2.7
    creating build/temp.linux-i686-2.7/src
    gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o
    src/MD2.c:31:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Command "/home/atagar/Desktop/stem/.tox/py27/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-yAroj3/pycrypto/';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-LN8AB6-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/atagar/Desktop/stem/.tox/py27/include/site/python2.7" failed with error code 1 in /tmp/pip-build-yAroj3/pycrypto

Stepping back though, what this provides us is that if someone has all python interpreters installed then it installs dependencies to a chroot and runs the tests - right?

I don't maintain our Jenkins instance, Peter does (weasel on irc) and he's only ok with installing things from the debian repositories. As such python 2.6 is out (it no longer has a package), and I'm not sure if tox/virtualenv are packaged.

comment:2 Changed 6 years ago by Foxboron

The error appears because you don't got the Python.h files, thus unable to compile pycrypt (i believe?). The solution is to get the python build files, don't know the correct package on your part though :)
Looks like debian got packages for all that. So that should not be a problem.
Even if there is a problem with getting it on jenkins, i think we need this anyway to help test stem over multiple versions in a better.

comment:3 Changed 6 years ago by atagar

Even if there is a problem with getting it on jenkins, i think we need this anyway to help test stem over multiple versions in a better.

In that case would you mind including a new "How can I test compatibility with multiple versions of python?" FAQ entry that walks contributors through this assuming they've never heard of tox before?

comment:4 Changed 5 years ago by Foxboron

Added some docs and updated tox.ini so you can add position args for through tox.

Wrote the examples as you'd be using something debian based, but not sure if i should add a PPA to get older python versions`?


comment:5 Changed 5 years ago by atagar

Resolution: implemented
Status: newclosed

Sorry about the delay! Looks good. make a couple small tweaks and pushed.

Note: See TracTickets for help on using tickets.