Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox in parallel leaks TOXENV to subprocess #1444

Closed
hroncok opened this issue Oct 21, 2019 · 12 comments · Fixed by #1446
Closed

tox in parallel leaks TOXENV to subprocess #1444

hroncok opened this issue Oct 21, 2019 · 12 comments · Fixed by #1446

Comments

@hroncok
Copy link
Contributor

@hroncok hroncok commented Oct 21, 2019

When running tox from within tox in parallel mode, the tox env of the inner tox is changed unlike when running it without parallel mode. This used to work with detox.

Get the latest tox

[totox]$ python3.7 -m venv venv
[totox]$ . venv/bin/activate
(venv) [totox]$ pip install tox
...
Successfully installed filelock-3.0.12 importlib-metadata-0.23 more-itertools-7.2.0 packaging-19.2 pluggy-0.13.0 py-1.8.0 pyparsing-2.4.2 six-1.12.0 toml-0.10.0 tox-3.14.0 virtualenv-16.7.6 zipp-0.6.0

Create an inner project with simple tox.ini

(venv) [totox]$ mkdir inner
(venv) [totox]$ cat > inner/tox.ini
[tox]
envlist = py36,py37,py38
skipsdist = True

[testenv]
commands =
    python -c 'import sys; print(sys.version)'

(venv) [totox]$ cd inner
(venv) [inner]$ tox
py36 create: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='3754984691'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
py37 create: /home/churchyard/tmp/totox/inner/.tox/py37
py37 run-test-pre: PYTHONHASHSEED='3754984691'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
py38 create: /home/churchyard/tmp/totox/inner/.tox/py38
py38 run-test-pre: PYTHONHASHSEED='3754984691'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
____________________________________________________ summary ____________________________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  congratulations :)
(venv) [inner]$ cd ..

See that invoking the inner dir's tox via subprocess works

(venv) [totox]$ cat > runner.py 
import os
import subprocess
import sys

os.chdir('inner')
cp = subprocess.run(('tox'), stdout=subprocess.PIPE, encoding='utf-8')
sys.stdout.write(cp.stdout)
assert 'py36' in cp.stdout
assert 'py37' in cp.stdout
assert 'py38' in cp.stdout

$ python runner.py 
py36 run-test-pre: PYTHONHASHSEED='1574627210'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
py37 run-test-pre: PYTHONHASHSEED='1574627210'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
py38 run-test-pre: PYTHONHASHSEED='1574627210'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
___________________________________ summary ____________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  congratulations :)

Create an outer tox.ini

(venv) [totox]$ cat > tox.ini
[tox]
envlist = py36,py37,py38
skipsdist = True

[testenv]
commands =
    python runner.py

(venv) [totox]$ tox
py36 run-test-pre: PYTHONHASHSEED='2559423246'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='3996979208'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
py37 run-test-pre: PYTHONHASHSEED='3996979208'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
py38 run-test-pre: PYTHONHASHSEED='3996979208'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
___________________________________ summary ____________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  congratulations :)
py37 run-test-pre: PYTHONHASHSEED='2559423246'
py37 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='2567171383'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
py37 run-test-pre: PYTHONHASHSEED='2567171383'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
py38 run-test-pre: PYTHONHASHSEED='2567171383'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
___________________________________ summary ____________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  congratulations :)
py38 run-test-pre: PYTHONHASHSEED='2559423246'
py38 run-test: commands[0] | python runner.py
py36 run-test-pre: PYTHONHASHSEED='3723348688'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
py37 run-test-pre: PYTHONHASHSEED='3723348688'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
py38 recreate: /home/churchyard/tmp/totox/inner/.tox/py38
py38 run-test-pre: PYTHONHASHSEED='3723348688'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
___________________________________ summary ____________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  congratulations :)
____________________________________________________ summary ____________________________________________________
  py36: commands succeeded
  py37: commands succeeded
  py38: commands succeeded
  congratulations :)

Run tox in parallel

$ tox -p all
⠸ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
  File "runner.py", line 8, in <module>
    assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)

==================================================== log end ====================================================
✖ FAIL py37 in 1.389 seconds
⠴ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
  File "runner.py", line 8, in <module>
    assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)

==================================================== log end ====================================================
✖ FAIL py38 in 1.536 seconds
⠇ [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
  File "runner.py", line 9, in <module>
    assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)

==================================================== log end ====================================================
✖ FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR:   py36: parallel child exit code 1
ERROR:   py37: parallel child exit code 1
ERROR:   py38: parallel child exit code 1
$ tox -p all -rvv
using tox.ini: /home/churchyard/tmp/totox/tox.ini (pid 3993)
  removing /home/churchyard/tmp/totox/.tox/log
using tox-3.14.0 from /home/churchyard/tmp/totox/venv/lib64/python3.7/site-packages/tox/__init__.py (pid 3993)
skipping sdist step
⠋ [0] py36 start: parallel py36 
py37 start: parallel py37 
py38 start: parallel py38 
[4001] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/venv/bin/python3.7 venv/lib64/python3.7/site-packages/tox/__main__.py -p all -rvv >.tox/py36/log/py36-7.log
[4002] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/venv/bin/python3.7 venv/lib64/python3.7/site-packages/tox/__main__.py -p all -rvv >.tox/py38/log/py38-7.log
[4003] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/venv/bin/python3.7 venv/lib64/python3.7/site-packages/tox/__main__.py -p all -rvv >.tox/py37/log/py37-7.log
⠋ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-7.log
=================================================== log start ===================================================
using tox.ini: /home/churchyard/tmp/totox/tox.ini (pid 4003)
using tox-3.14.0 from /home/churchyard/tmp/totox/venv/lib64/python3.7/site-packages/tox/__init__.py (pid 4003)
skipping sdist step
py37 start: getenv /home/churchyard/tmp/totox/.tox/py37
py37 cannot reuse: -r flag
py37 recreate: /home/churchyard/tmp/totox/.tox/py37
py37 uses /home/churchyard/tmp/totox/venv/bin/python3.7
setting PATH=/home/churchyard/tmp/totox/.tox/py37/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4019] /home/churchyard/tmp/totox/.tox$ /home/churchyard/tmp/totox/venv/bin/python3.7 -m virtualenv --no-download --python /home/churchyard/tmp/totox/venv/bin/python3.7 py37
Already using interpreter /home/churchyard/tmp/totox/venv/bin/python3.7
Using base prefix '/usr'
  No LICENSE.txt / LICENSE found in source
New python executable in /home/churchyard/tmp/totox/.tox/py37/bin/python3.7
Also creating executable in /home/churchyard/tmp/totox/.tox/py37/bin/python
Installing setuptools, pip, wheel...
done.
py37 finish: getenv /home/churchyard/tmp/totox/.tox/py37 after 3.55 seconds
py37 start: finishvenv 
write config to /home/churchyard/tmp/totox/.tox/py37/.tox-config1 as 'eaaae8efa6683818b83c05b3c7e4e9d1cffb0a05f2771eb7feb68e936cc43729 /home/churchyard/tmp/totox/venv/bin/python3.7\n3.14.0 0 0 0'
py37 finish: finishvenv  after 0.00 seconds
py37 start: envreport 
setting PATH=/home/churchyard/tmp/totox/.tox/py37/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4045] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/.tox/py37/bin/python -m pip freeze >.tox/py37/log/py37-8.log
py37 finish: envreport  after 0.30 seconds
py37 installed: 
py37 start: run-test-pre 
py37 run-test-pre: PYTHONHASHSEED='854761255'
py37 finish: run-test-pre  after 0.00 seconds
py37 start: run-test 
py37 run-test: commands[0] | python runner.py
setting PATH=/home/churchyard/tmp/totox/.tox/py37/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4048] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py
py37 run-test-pre: PYTHONHASHSEED='1588756240'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
  File "runner.py", line 8, in <module>
    assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
py37 finish: run-test  after 0.87 seconds
py37 start: run-test-post 
py37 finish: run-test-post  after 0.00 seconds

==================================================== log end ====================================================
✖ FAIL py37 in 5.028 seconds
⠙ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-7.log
=================================================== log start ===================================================
using tox.ini: /home/churchyard/tmp/totox/tox.ini (pid 4001)
using tox-3.14.0 from /home/churchyard/tmp/totox/venv/lib64/python3.7/site-packages/tox/__init__.py (pid 4001)
skipping sdist step
py36 start: getenv /home/churchyard/tmp/totox/.tox/py36
py36 cannot reuse: -r flag
py36 recreate: /home/churchyard/tmp/totox/.tox/py36
python3.6 (/usr/bin/python3.6) is {'executable': '/usr/bin/python3.6', 'name': 'python', 'version_info': [3, 6, 9, 'final', 0], 'version': '3.6.9 (default, Jul  3 2019, 15:08:07) \n[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]', 'is_64': True, 'sysplatform': 'linux'}
py36 uses /usr/bin/python3.6
setting PATH=/home/churchyard/tmp/totox/.tox/py36/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4021] /home/churchyard/tmp/totox/.tox$ /home/churchyard/tmp/totox/venv/bin/python3.7 -m virtualenv --no-download --python /usr/bin/python3.6 py36
Already using interpreter /usr/bin/python3.6
Using base prefix '/usr'
  No LICENSE.txt / LICENSE found in source
New python executable in /home/churchyard/tmp/totox/.tox/py36/bin/python3.6
Also creating executable in /home/churchyard/tmp/totox/.tox/py36/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /usr/bin/python3.6
py36 finish: getenv /home/churchyard/tmp/totox/.tox/py36 after 3.75 seconds
py36 start: finishvenv 
write config to /home/churchyard/tmp/totox/.tox/py36/.tox-config1 as 'efad2735c97af92da744518585e8e7cca18026980c32955634a56ba3ea1b61e0 /usr/bin/python3.6\n3.14.0 0 0 0'
py36 finish: finishvenv  after 0.00 seconds
py36 start: envreport 
setting PATH=/home/churchyard/tmp/totox/.tox/py36/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4047] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/.tox/py36/bin/python -m pip freeze >.tox/py36/log/py36-8.log
py36 finish: envreport  after 0.36 seconds
py36 installed: 
py36 start: run-test-pre 
py36 run-test-pre: PYTHONHASHSEED='1851229867'
py36 finish: run-test-pre  after 0.00 seconds
py36 start: run-test 
py36 run-test: commands[0] | python runner.py
setting PATH=/home/churchyard/tmp/totox/.tox/py36/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4058] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py
py36 run-test-pre: PYTHONHASHSEED='4221253215'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul  3 2019, 15:08:07) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
  File "runner.py", line 9, in <module>
    assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
py36 finish: run-test  after 0.74 seconds
py36 start: run-test-post 
py36 finish: run-test-post  after 0.00 seconds

==================================================== log end ====================================================
✖ FAIL py36 in 5.155 seconds
⠹ [1] py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-7.log
=================================================== log start ===================================================
using tox.ini: /home/churchyard/tmp/totox/tox.ini (pid 4002)
using tox-3.14.0 from /home/churchyard/tmp/totox/venv/lib64/python3.7/site-packages/tox/__init__.py (pid 4002)
skipping sdist step
py38 start: getenv /home/churchyard/tmp/totox/.tox/py38
py38 cannot reuse: -r flag
py38 recreate: /home/churchyard/tmp/totox/.tox/py38
python3.8 (/usr/bin/python3.8) is {'executable': '/usr/bin/python3.8', 'name': 'python', 'version_info': [3, 8, 0, 'final', 0], 'version': '3.8.0 (default, Oct 16 2019, 12:47:36) \n[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]', 'is_64': True, 'sysplatform': 'linux'}
py38 uses /usr/bin/python3.8
setting PATH=/home/churchyard/tmp/totox/.tox/py38/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4020] /home/churchyard/tmp/totox/.tox$ /home/churchyard/tmp/totox/venv/bin/python3.7 -m virtualenv --no-download --python /usr/bin/python3.8 py38
Already using interpreter /usr/bin/python3.8
Using base prefix '/usr'
New python executable in /home/churchyard/tmp/totox/.tox/py38/bin/python3.8
Also creating executable in /home/churchyard/tmp/totox/.tox/py38/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /usr/bin/python3.8
py38 finish: getenv /home/churchyard/tmp/totox/.tox/py38 after 4.01 seconds
py38 start: finishvenv 
write config to /home/churchyard/tmp/totox/.tox/py38/.tox-config1 as '2c1177eb2a9d75d83e4056f856ef5a366e6aa88c1b679c3e880aa7f27a83035d /usr/bin/python3.8\n3.14.0 0 0 0'
py38 finish: finishvenv  after 0.00 seconds
py38 start: envreport 
setting PATH=/home/churchyard/tmp/totox/.tox/py38/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4051] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/.tox/py38/bin/python -m pip freeze >.tox/py38/log/py38-8.log
py38 finish: envreport  after 0.28 seconds
py38 installed: 
py38 start: run-test-pre 
py38 run-test-pre: PYTHONHASHSEED='3191648311'
py38 finish: run-test-pre  after 0.00 seconds
py38 start: run-test 
py38 run-test: commands[0] | python runner.py
setting PATH=/home/churchyard/tmp/totox/.tox/py38/bin:/home/churchyard/tmp/totox/venv/bin:/usr/libexec/python3-sphinx:/home/churchyard/.local/bin:/home/churchyard/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
[4060] /home/churchyard/tmp/totox$ /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py
py38 run-test-pre: PYTHONHASHSEED='2337141942'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
  File "runner.py", line 8, in <module>
    assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
py38 finish: run-test  after 0.71 seconds
py38 start: run-test-post 
py38 finish: run-test-post  after 0.00 seconds

==================================================== log end ====================================================
✖ FAIL py38 in 5.287 seconds
____________________________________________________ summary ____________________________________________________
ERROR:   py36: parallel child exit code 1
ERROR:   py37: parallel child exit code 1
ERROR:   py38: parallel child exit code 1
@hroncok hroncok added the bug:normal label Oct 21, 2019
@hroncok hroncok changed the title Tox in paralel poisons TOXENV Tox in parallel leaks TOXENV to subprocess Oct 21, 2019
@gaborbernat gaborbernat changed the title Tox in parallel leaks TOXENV to subprocess tox in parallel leaks TOXENV to subprocess Oct 21, 2019
@gaborbernat

This comment has been minimized.

Copy link
Member

@gaborbernat gaborbernat commented Oct 21, 2019

We use TOXENV to signal to the sub-process child what environment to run. Agreed that subprocesses from within that parallel run should not pass it along. PR welcomed!

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

It seem that TOX_PARALLEL_ENV is acually used. And tox respects this even when not run in parallel.

An obvious workaround for this problem is to not respect TOX_PARALLEL_ENV when not being a paralllel worker.

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

tox recognizes itself as a parallel worker if TOX_PARALLEL_ENV is set.

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

Removing this line from passenv fixes the problem:

str(PARALLEL_ENV_VAR_KEY),

I'm investigating why it is in there in the first place.

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

This was added in #1139 and fixing it would contradict the entire purpose of that PR. Not sure how to proceed, please advise.

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

Solution ideas:

  1. use one envvar to control the bahavior of tox, use another envvar to signal to other things that tox was invoked in the parallel mode
  2. use ("private") tox command line option to control the behavior of tox parallel worker, not env vars
@gaborbernat

This comment has been minimized.

Copy link
Member

@gaborbernat gaborbernat commented Oct 21, 2019

I would suggest proposal 1 🤔

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

Any name suggestions? _TOX_PARALLEL_ENV?

@BenjamenMeyer

This comment has been minimized.

Copy link

@BenjamenMeyer BenjamenMeyer commented Oct 21, 2019

TOX_INTERNAL_.... instead of _TOX_...?

@gaborbernat

This comment has been minimized.

Copy link
Member

@gaborbernat gaborbernat commented Oct 21, 2019

_TOX_PARALLEL_ENV is sane enough 👍 the underscore shows its private

@hroncok

This comment has been minimized.

Copy link
Contributor Author

@hroncok hroncok commented Oct 21, 2019

Working on it, but will not yet have a PR ready today.

hroncok added a commit to hroncok/tox that referenced this issue Oct 21, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 21, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 22, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 22, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 22, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 22, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 22, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).
hroncok added a commit to hroncok/tox that referenced this issue Oct 22, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).

The integration test is a tad complicated invoking subprocess.Popen instead
of subprocess.run, to support Python 2.7 and 3.4.
hroncok added a commit to hroncok/tox that referenced this issue Oct 23, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).

The integration test is a tad complicated invoking subprocess.Popen instead
of subprocess.run, to support Python 2.7 and 3.4.
hroncok added a commit to hroncok/tox that referenced this issue Oct 23, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).

The integration test is a tad complicated invoking subprocess.Popen instead
of subprocess.run, to support Python 2.7 and 3.4.
hroncok added a commit to hroncok/tox that referenced this issue Oct 23, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).

The integration test is a tad complicated invoking subprocess.Popen instead
of subprocess.run, to support Python 2.7 and 3.4.
hroncok added a commit to hroncok/tox that referenced this issue Oct 23, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
tox-dev#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes tox-dev#1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).

The integration test is a tad complicated invoking subprocess.Popen instead
of subprocess.run, to support Python 2.7 and 3.4.
gaborbernat added a commit that referenced this issue Nov 11, 2019
...but keep the TOX_PARALLEL_ENV variable for others to consume.

The problem with using environment variables to let tox know it's being run
as a parallel worker is the following:

Either you don't pass the environment variable, but the test frameworks and
test suites are unaware that tox is running in parallel.
This makes it hard for cases like pytest-django:
#1139

Or you pass the environment variable, but it makes tox invoked within tox
think it is a parallel worker even when it isn't.
This makes it hard to test various tox plugins that invoke tox in their
integration test suite:
Fixes #1444

By introducing two variables we can use one ("private", _TOX_PARALLEL_ENV) to
control the behavior of tox (and don't pass it) and another ("public",
TOX_PARALLEL_ENV) to let the tests and test frameworks know tox is running
in parallel (and pass it by default).

The integration test is a tad complicated invoking subprocess.Popen instead
of subprocess.run, to support Python 2.7 and 3.4.
@gaborbernat

This comment has been minimized.

Copy link
Member

@gaborbernat gaborbernat commented Nov 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.