question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tox fails on first run

See original GitHub issue

On a fresh checkout of the source repository, running tox fails on its first run with the error below. I’m not familiar with the stages tox performs (and they seem poorly documented), but the “install” step does not actually seem to install the source into the virtualenv for some reason.

The [testenv].commands entry in tox.ini specifies that py.test should look for test cases in {envsitepackagesdir}/jks (and also in {toxinidir}/tests, why twice?), but because of the dist seemingly not actually getting installed, that directory doesn’t exist and tox errors out.

Reproducible on Ubuntu 16.04 and CentOS 7, in both cases with Python 2.7 as the default system python version. The same thing happens for all the other environments in tox.ini as well.

vmuser@vm:~/pyjks$ rm -rf .tox/; tox -v -e py27
using tox.ini: /home/vmuser/pyjks/tox.ini
using tox-2.3.1 from /usr/local/lib/python2.7/dist-packages/tox/__init__.pyc
GLOB sdist-make: /home/vmuser/pyjks/setup.py
  /home/vmuser/pyjks$ /usr/bin/python /home/vmuser/pyjks/setup.py sdist --formats=zip --dist-dir /home/vmuser/pyjks/.tox/dist >/home/vmuser/pyjks/.tox/log/tox-0.log
py27 create: /home/vmuser/pyjks/.tox/py27
  /home/vmuser/pyjks/.tox$ /usr/bin/python -m virtualenv --python /usr/bin/python2.7 py27 >/home/vmuser/pyjks/.tox/py27/log/py27-0.log
py27 installdeps: -rrequirements-test.txt
  /home/vmuser/pyjks$ /home/vmuser/pyjks/.tox/py27/bin/pip install -rrequirements-test.txt >/home/vmuser/pyjks/.tox/py27/log/py27-1.log
py27 inst: /home/vmuser/pyjks/.tox/dist/pyjks-0.5.1.dev0.zip
  /home/vmuser/pyjks$ /home/vmuser/pyjks/.tox/py27/bin/pip install /home/vmuser/pyjks/.tox/dist/pyjks-0.5.1.dev0.zip >/home/vmuser/pyjks/.tox/py27/log/py27-2.log
  /home/vmuser/pyjks$ /home/vmuser/pyjks/.tox/py27/bin/pip freeze >/home/vmuser/pyjks/.tox/py27/log/py27-3.log
py27 installed: javaobj-py3==0.1.4,pluggy==0.3.1,py==1.4.31,pyasn1==0.1.7,pyasn1-modules==0.0.8,pycrypto==2.6.1,pyjks==0.5.1.dev0,pytest==2.9.2,tox==2.3.1,twofish==0.3.0,virtualenv==15.0.2
py27 runtests: PYTHONHASHSEED='2807748729'
py27 runtests: commands[0] | py.test --doctest-modules /home/vmuser/pyjks/.tox/py27/lib/python2.7/site-packages/jks /home/vmuser/pyjks/tests
  /home/vmuser/pyjks/.tox$ /home/vmuser/pyjks/.tox/py27/bin/py.test --doctest-modules /home/vmuser/pyjks/.tox/py27/lib/python2.7/site-packages/jks /home/vmuser/pyjks/tests 
================================================================== test session starts ===================================================================
platform linux2 -- Python 2.7.12, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/vmuser/pyjks, inifile: 

============================================================== no tests ran in 0.00 seconds ==============================================================
ERROR: file not found: /home/vmuser/pyjks/.tox/py27/lib/python2.7/site-packages/jks
ERROR: InvocationError: '/home/vmuser/pyjks/.tox/py27/bin/py.test --doctest-modules /home/vmuser/pyjks/.tox/py27/lib/python2.7/site-packages/jks /home/vmuser/pyjks/tests'
________________________________________________________________________ summary _________________________________________________________________________
ERROR:   py27: commands failed

The following line from the output suggests that tox is installing the source distribution in the virtual env:

/home/vmuser/pyjks$ /home/vmuser/pyjks/.tox/py27/bin/pip install /home/vmuser/pyjks/.tox/dist/pyjks-0.5.1.dev0.zip >/home/vmuser/pyjks/.tox/py27/log/py27-2.log

But it is nowhere to be found:

vmuser@vm:~/pyjks$ (. .tox/py27/bin/activate; pip freeze -l)
javaobj-py3==0.1.4
pluggy==0.3.1
py==1.4.31
pyasn1==0.1.7
pyasn1-modules==0.0.8
pycrypto==2.6.1
pytest==2.9.2
tox==2.3.1
twofish==0.3.0
virtualenv==15.0.2

Exact version numbers:

vmuser@vm:~/pyjks$ python --version
Python 2.7.12
vmuser@vm:~/pyjks$ tox --version
2.3.1 imported from /usr/local/lib/python2.7/dist-packages/tox/__init__.pyc
vmuser@vm:~/pyjks$ virtualenv --version
15.0.3

Contents of /home/vmuser/pyjks/.tox/py27/log/py27-2.log:

vmuser@vm:~/pyjks$ cat /home/vmuser/pyjks/.tox/py27/log/py27-2.log
actionid: py27
msg: installpkg
cmdargs: [local('/home/vmuser/pyjks/.tox/py27/bin/pip'), 'install', '/home/vmuser/pyjks/.tox/dist/pyjks-0.5.1.dev0.zip']
env: {'LC_NUMERIC': 'en_US.UTF-8', 'QT_QPA_PLATFORMTHEME': 'appmenu-qt5', 'XDG_GREETER_DATA_DIR': '/var/lib/lightdm-data/vmuser', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'LC_MEASUREMENT': 'en_US.UTF-8', 'UPSTART_EVENTS': 'xsession started', 'XDG_CURRENT_DESKTOP': 'Unity', 'LC_PAPER': 'en_US.UTF-8', 'TMOUT': '0', 'QT_IM_MODULE': 'ibus', 'LOGNAME': 'vmuser', 'USER': 'vmuser', 'PATH': '/home/vmuser/pyjks/.tox/py27/bin:/home/vmuser/local/bin:/home/vmuser/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin', 'XDG_VTNR': '7', 'GNOME_KEYRING_CONTROL': '', 'DISPLAY': ':0', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm-256color', 'SHELL': '/bin/bash', 'XDG_SESSION_PATH': '/org/freedesktop/DisplayManager/Session0', 'XAUTHORITY': '/home/vmuser/.Xauthority', 'LANGUAGE': 'en_US', 'INSTANCE': '', 'LC_MONETARY': 'en_US.UTF-8', 'QT_LINUX_ACCESSIBILITY_ALWAYS_ON': '1', 'MANDATORY_PATH': '/usr/share/gconf/ubuntu.mandatory.path', 'QT_ACCESSIBILITY': '1', 'VIRTUAL_ENV': '/home/vmuser/pyjks/.tox/py27', 'UPSTART_INSTANCE': '', 'COMPIZ_CONFIG_PROFILE': 'ubuntu', 'WINDOWID': '56959269', 'MANPATH': '/home/vmuser/local/share/man:/home/vmuser/local/share/man:', 'CLUTTER_IM_MODULE': 'xim', 'XMODIFIERS': '@im=ibus', 'PYTHONHASHSEED': '3183146666', 'GPG_AGENT_INFO': '/home/vmuser/.gnupg/S.gpg-agent:0:1', 'HOME': '/home/vmuser', 'QT4_IM_MODULE': 'xim', 'GTK2_MODULES': 'overlay-scrollbar', 'XDG_SESSION_DESKTOP': 'ubuntu', 'COMPIZ_BIN_PATH': '/usr/bin/', 'XDG_RUNTIME_DIR': '/run/user/1000', 'LC_IDENTIFICATION': 'en_US.UTF-8', 'LC_ADDRESS': 'en_US.UTF-8', 'PYTHONPATH': '/home/vmuser/local/lib64/python2.6/site-packages:/home/vmuser/local/lib64/python2.6/site-packages:', 'SESSIONTYPE': 'gnome-session', 'SESSION': 'ubuntu', 'VTE_VERSION': '4205', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'GDMSESSION': 'ubuntu', 'IM_CONFIG_PHASE': '1', 'UPSTART_JOB': 'unity7', 'TMUX': '/tmp/tmux-1000/default,5533,3', 'XDG_DATA_DIRS': '/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop', 'XDG_SEAT_PATH': '/org/freedesktop/DisplayManager/Seat0', 'XDG_SESSION_ID': 'c1', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-QLVgZX6JqO', '_': '/usr/local/bin/tox', 'DEFAULTS_PATH': '/usr/share/gconf/ubuntu.default.path', 'GTK_IM_MODULE': 'ibus', 'DESKTOP_SESSION': 'ubuntu', 'UPSTART_SESSION': 'unix:abstract=/com/ubuntu/upstart-session/1000/4389', 'XDG_CONFIG_DIRS': '/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg', 'GNOME_KEYRING_PID': '', 'XDG_SESSION_TYPE': 'x11', 'TERMINFO': '/home/vmuser/.terminfo', 'GDM_LANG': 'en_US', 'LC_TELEPHONE': 'en_US.UTF-8', 'GTK_MODULES': 'gail:atk-bridge:unity-gtk-module', 'PAPERSIZE': 'letter', 'SHLVL': '3', 'PWD': '/home/vmuser/pyjks', 'JOB': 'unity-settings-daemon', 'SWT_GTK3': '0', 'LC_NAME': 'en_US.UTF-8', 'LC_TIME': 'en_US.UTF-8', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'TMUX_PANE': '%54', 'XDG_SEAT': 'seat0'}

Processing ./.tox/dist/pyjks-0.5.1.dev0.zip
  Requirement already satisfied (use --upgrade to upgrade): pyjks==0.5.1.dev0 from file:///home/vmuser/pyjks/.tox/dist/pyjks-0.5.1.dev0.zip in /home/vmuser/pyjks
Requirement already satisfied (use --upgrade to upgrade): pyasn1 in ./.tox/py27/lib/python2.7/site-packages (from pyjks==0.5.1.dev0)
Requirement already satisfied (use --upgrade to upgrade): pyasn1_modules in ./.tox/py27/lib/python2.7/site-packages (from pyjks==0.5.1.dev0)
Requirement already satisfied (use --upgrade to upgrade): javaobj-py3 in ./.tox/py27/lib/python2.7/site-packages (from pyjks==0.5.1.dev0)
Requirement already satisfied (use --upgrade to upgrade): pycrypto in ./.tox/py27/lib/python2.7/site-packages (from pyjks==0.5.1.dev0)
Requirement already satisfied (use --upgrade to upgrade): twofish in ./.tox/py27/lib/python2.7/site-packages (from pyjks==0.5.1.dev0)
Building wheels for collected packages: pyjks
  Running setup.py bdist_wheel for pyjks: started
  Running setup.py bdist_wheel for pyjks: finished with status 'done'
  Stored in directory: /home/vmuser/.cache/pip/wheels/23/00/59/df3c23a752fa609874cf336943df85d00b2175fd94ee002d45
Successfully built pyjks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
markrwilliamscommented, Aug 23, 2016

@voetsjoeba Glad to help 😃

We could configure tox.ini to unset PYTHONPATH for all test environments. On the one hand, that’d solve this issue, but on the other, maybe it’s really necessary to set PYTHONPATH sometimes. I’m kind of thinking we shouldn’t touch tox.ini. But that may be laziness and not caution!

1reaction
voetsjoebacommented, Aug 23, 2016

@markrwilliams Well I’ll be danged, that’s exactly it. Can reproduce on the fresh VM, and can confirm the fix on the original VM.

I would have expected a :. at the end to have that effect, but not a plain :. Lesson learned: bashrc oneliners of the form export PYTHONPATH="$HOME/local/lib64/python2.6/site-packages:$PYTHONPATH" are bad for you.

Not sure yet if tox.ini has something that can allow you to check for that (I’m not at all familiar with the tool yet), but if there is, I’m all in favor of adding that in.

Good looking out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[tox4] first run succeeds, second run fails · Issue #2041 - GitHub
The fail is thrown by buildout. tox correctly provisions setuptools<52 . Then the first buildout run checks at the beginning this constraint is ......
Read more >
General tips and tricks — tox 3.4.0 documentation
When a command (defined by commands = in tox.ini ) fails, it has a non-zero exit code, and an InvocationError exception is raised...
Read more >
tox command fails but full command works manually
I have a tox env called unit_tests that I use to try to execute tests with pytest_django . When called the command tox...
Read more >
Running Commands with Tox - Python Packaging Guide
The first thing to configure tox to do is to run the tests for a package. ... through to pytest use -- here...
Read more >
pip install tox==3.4.0 - PyPI
tox is a generic virtualenv management and test command line tool you can use for: checking your package installs correctly with different Python...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found