summaryrefslogtreecommitdiff
path: root/tests/tox_env/python/test_python_api.py
blob: c7256d9fbeea9c21cd7f439fb77fa2fa06b991b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from pathlib import Path

from packaging.requirements import Requirement

from tox.tox_env.python.api import PythonDep


def test_deps_path_eq() -> None:
    dep_1 = PythonDep(Path.cwd())
    dep_2 = PythonDep(Path.cwd())
    assert dep_1 == dep_2


def test_deps_path_ne() -> None:
    dep_1 = PythonDep(Path.cwd())
    dep_2 = PythonDep(Path.cwd() / "a")
    assert dep_1 != dep_2


def test_deps_req_eq() -> None:
    dep_1 = PythonDep(Requirement("pytest"))
    dep_2 = PythonDep(Requirement("pytest"))
    assert dep_1 == dep_2


def test_deps_req_ne() -> None:
    dep_1 = PythonDep(Requirement("pytest"))
    dep_2 = PythonDep(Requirement("tox"))
    assert dep_1 != dep_2


def test_deps_repr() -> None:
    dep_1 = PythonDep(Path.cwd())
    assert repr(dep_1) == f"PythonDep(value={Path.cwd()!r})"