tox-factor icon indicating copy to clipboard operation
tox-factor copied to clipboard

tox-factor does not work with tox 4

Open aabmass opened this issue 2 years ago • 3 comments

Any tox command immediately fails after installing tox-factor alongside tox 4:

tox --version
ROOT: No tox.ini or setup.cfg or pyproject.toml found, assuming empty tox.ini at /tmp/tmp.ZZGIilhvQf
Traceback (most recent call last):
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox_factor/compat.py", line 2, in <module>
    from tox.config.parallel import ENV_VAR_KEY_PUBLIC as TOX_PARALLEL_ENV
ModuleNotFoundError: No module named 'tox.config.parallel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/tmp.ZZGIilhvQf/venv/bin/tox", line 8, in <module>
    sys.exit(run())
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/run.py", line 19, in run
    result = main(sys.argv[1:] if args is None else args)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/run.py", line 38, in main
    state = setup_state(args)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/run.py", line 53, in setup_state
    options = get_options(*args)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/config/cli/parse.py", line 38, in get_options
    guess_verbosity, log_handler, source = _get_base(args)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/config/cli/parse.py", line 61, in _get_base
    MANAGER.load_plugins(source.path)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/plugin/manager.py", line 90, in load_plugins
    self._register_plugins(inline)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox/plugin/manager.py", line 38, in _register_plugins
    self.manager.load_setuptools_entrypoints(NAME)
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox_factor/hooks.py", line 5, in <module>
    from .compat import TOX_PARALLEL_ENV
  File "/tmp/tmp.ZZGIilhvQf/venv/lib/python3.10/site-packages/tox_factor/compat.py", line 4, in <module>
    from tox.config.parallel import ENV_VAR_KEY as TOX_PARALLEL_ENV
ModuleNotFoundError: No module named 'tox.config.parallel'

tested in a fresh python 3.10 virtualenv, pip freeze output

cachetools==5.2.0
chardet==5.1.0
colorama==0.4.6
distlib==0.3.6
filelock==3.9.0
packaging==22.0
platformdirs==2.6.2
pluggy==1.0.0
pyproject_api==1.4.0
tomli==2.0.1
tox==4.2.5
tox-factor==0.1.2
virtualenv==20.17.

aabmass avatar Jan 06 '23 22:01 aabmass

Tox 4.x includes the "-f" factor option by default. You can remove tox-factor from your dependencies/requirements and tox should continue to work as before.

kevinmasterson avatar Mar 16 '23 16:03 kevinmasterson

Would be nice to add a note to the README of this project pointing this out. I can send a PR or we can just close this issue

aabmass avatar Aug 08 '23 18:08 aabmass

I added a note in PR #19.

iurisilvio avatar Jan 07 '24 11:01 iurisilvio