summaryrefslogtreecommitdiff
path: root/tests/plugin/test_inline.py
blob: 3ea04cc9bed3b6c63ceed264067b189ec0e8ced6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from __future__ import annotations

from tox.pytest import ToxProjectCreator


def test_inline_tox_py(tox_project: ToxProjectCreator) -> None:
    def plugin() -> None:  # pragma: no cover # the code is copied to a python file
        import logging

        from tox.config.cli.parser import ToxParser
        from tox.plugin import impl

        @impl
        def tox_add_option(parser: ToxParser) -> None:
            logging.warning("Add magic")
            parser.add_argument("--magic", action="store_true")

    project = tox_project({"toxfile.py": plugin})
    result = project.run("-h")
    result.assert_success()
    assert "--magic" in result.out