Skip to content

[BUG] Tox incorrectly assumes that deps entries containing ~ in the middle are paths #3447

@webknjaz

Description

@webknjaz

Issue

$sbj. I've found this while trying to list a dependency with a compatibility operator in the requirement specifier. ~= triggers the bug, >= works. Tox prepends ./ to the requirement, I haven't attempted debugging further.

Environment

I checked this back to 4.0, and it's a problem on every version. I haven't checked if tox v3 had this bug.

Output of running tox

$ tox r -e pre-commit -- pylint -v --all-files
pre-commit: install_deps> python -I -m pip install './pre-commit ~= 4'
ERROR: Invalid requirement: './pre-commit ~= 4': Expected package name at the start of dependency specifier
    ./pre-commit ~= 4
    ^
Hint: It looks like a path. File './pre-commit ~= 4' does not exist.
pre-commit: exit 1 (0.24 seconds) ~/src/github/prj/path> python -I -m pip install './pre-commit ~= 4' pid=128886
  pre-commit: FAIL code 1 (0.26 seconds)
  evaluation failed :( (0.30 seconds)

Minimal example

[testenv:pre-commit]
...
deps =
  pre-commit ~= 4
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions