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

ValueError on formatting a valid tox.ini #17

Closed
Julian opened this issue Oct 1, 2020 · 2 comments · Fixed by #20
Closed

ValueError on formatting a valid tox.ini #17

Julian opened this issue Oct 1, 2020 · 2 comments · Fixed by #20

Comments

@Julian
Copy link
Contributor

Julian commented Oct 1, 2020

Hi! (I don't know if this isn't yet intended to be used or not, if so apologies) --

Just tried to run it and got a ValueError with no message.

git clone https://github.com/Julian/regret && cd regret && tox-ini-fmt tox.ini should reproduce (I didn't look carefully at what's happening, so apologies if it's something simple):

⊙  git clone https://github.com/Julian/regret && cd regret && tox-ini-fmt tox.ini                                                                                                                 julian@Air
Cloning into 'regret'...
remote: Enumerating objects: 81, done.
remote: Counting objects: 100% (81/81), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 1007 (delta 47), reused 50 (delta 25), pack-reused 926
Receiving objects: 100% (1007/1007), 155.09 KiB | 5.35 MiB/s, done.
Resolving deltas: 100% (593/593), done.
Traceback (most recent call last):
  File "/Users/julian/.local/bin/tox-ini-fmt", line 8, in <module>
    sys.exit(run())
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/__main__.py", line 12, in run
    formatted = format_tox_ini(opts.tox_ini)
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/__init__.py", line 20, in format_tox_ini
    format_test_env(parser, section_name)
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/test_env.py", line 22, in format_test_env
    fix_and_reorder(parser, name, tox_section_cfg)
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/util.py", line 13, in fix_and_reorder
    section[key] = fix(section[key])
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/test_env.py", line 30, in to_deps
    return fmt_list(requires(value))
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/requires.py", line 13, in requires
    normalized = sorted(values, key=lambda req: (";" in req, _req_base(req), req))
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/requires.py", line 12, in <genexpr>
    values = (_normalize_req(req) for req in require_group)
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/requires.py", line 19, in _normalize_req
    normalized = _normalize_lib(lib)
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/requires.py", line 27, in _normalize_lib
    base = _req_base(lib)
  File "/Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.8/site-packages/tox_ini_fmt/formatter/requires.py", line 41, in _req_base
    raise ValueError(lib)
ValueError
@Julian
Copy link
Contributor Author

Julian commented Oct 1, 2020

Ah, as I'm pasting the traceback here, perhaps the explanation is just saying the parsing logic is confused by newlines.

@gaborbernat
Copy link
Member

Hi @Julian, we're just in early adopters phase. Your issue report is much appreciated. Fill free to do a PR fixing it, or if not I'll pick it up next week probabyl 👍

Julian added a commit to Julian/tox-ini-fmt that referenced this issue Oct 1, 2020
@helpr helpr bot added the pr-available label Oct 1, 2020
Julian added a commit to Julian/tox-ini-fmt that referenced this issue Oct 1, 2020
Would make issues like tox-dev#17 easier to diagnose
gaborbernat pushed a commit that referenced this issue Oct 1, 2020
* Skip empty requirement lines.

Closes: #17.

* Show reprs in invalid requirements.

Would make issues like #17 easier to diagnose
@helpr helpr bot added pr-merged and removed pr-available labels Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants