signalpillar / tox-battery

Experiments with Tox plugin system
MIT License
33 stars 3 forks source link

Parser fails if comments are used in requirements.txt #6

Closed underyx closed 7 years ago

underyx commented 7 years ago

The requirements.txt starts with:

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --output-file requirements.txt requirements.in
#

argparse==1.2.1

The traceback is:

Traceback (most recent call last):
  File "/usr/local/bin/tox", line 11, in <module>
    sys.exit(cmdline())
  File "/usr/local/lib/python3.6/site-packages/tox/session.py", line 38, in main
    config = prepare(args)
  File "/usr/local/lib/python3.6/site-packages/tox/session.py", line 26, in prepare
    config = parseconfig(args)
  File "/usr/local/lib/python3.6/site-packages/tox/config.py", line 246, in parseconfig
    pm.hook.tox_configure(config=config)
  File "/usr/local/lib/python3.6/site-packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/usr/local/lib/python3.6/site-packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.6/site-packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/usr/local/lib/python3.6/site-packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.6/site-packages/toxbat/requirements.py", line 38, in tox_configure
    return _ensure_envs_recreated_on_requirements_update(config)
  File "/usr/local/lib/python3.6/site-packages/toxbat/requirements.py", line 48, in _ensure_envs_recreated_on_requirements_update
    requires_recreation = are_requirements_changed(env)
  File "/usr/local/lib/python3.6/site-packages/toxbat/requirements.py", line 70, in are_requirements_changed
    for reqfile in requirement_files if reqfile and os.path.isfile(reqfile))
  File "/usr/local/lib/python3.6/site-packages/toxbat/requirements.py", line 70, in <genexpr>
    for reqfile in requirement_files if reqfile and os.path.isfile(reqfile))
  File "/usr/local/lib/python3.6/site-packages/toxbat/requirements.py", line 108, in is_changed
    previous_requirements_hash = int(content)
ValueError: invalid literal for int() with base 10: '#\n# This file is autogenerated by pip-compile\n# To update, run:\n#\n#    pip-compile --output-file requirements.txt requirements.in\n#\n\nargparse==1.2.1\n…

For now, it's possible to downgrade to tox-battery~=0.2.0 to work around this.

signalpillar commented 7 years ago

@underyx thanks for the reporting issue. In process of fixing it.

signalpillar commented 7 years ago

Hi Bence (@underyx).

Finally, I managed to release a new version with the fixes for 2 issues. With the release your issue should go as well.

Regards, Volodymyr