summaryrefslogtreecommitdiff
path: root/tests/config/source/test_setup_cfg.py
blob: 9ea67510077c8a50b806202fa8420519d1296d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import annotations

from tox.pytest import ToxProjectCreator


def test_conf_in_setup_cfg(tox_project: ToxProjectCreator) -> None:
    project = tox_project({"setup.cfg": "[tox:tox]\nenv_list=\n a\n b"})

    outcome = project.run("l")
    outcome.assert_success()
    assert outcome.out == "default environments:\na -> [no description]\nb -> [no description]\n"


def test_bad_conf_setup_cfg(tox_project: ToxProjectCreator) -> None:
    project = tox_project({"setup.cfg": "[tox]\nenv_list=\n a\n b"})
    filename = str(project.path / "setup.cfg")
    outcome = project.run("l", "-c", filename)
    outcome.assert_failed()
    assert outcome.out == f"ROOT: HandledError| could not recognize config file {filename}\n"