File: test_inline.py

package info (click to toggle)
tox 4.25.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,032 kB
  • sloc: python: 18,531; sh: 22; makefile: 14
file content (24 lines) | stat: -rw-r--r-- 745 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from tox.config.cli.parser import ToxParser
    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  # noqa: PLC0415

        from tox.plugin import impl  # noqa: PLC0415

        @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