summaryrefslogtreecommitdiff
path: root/src/tox/config/source/ini_section.py
blob: 33a718632a180b506a3f9e0537a85e4e92ce8cb6 (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
from __future__ import annotations

from tox.config.loader.ini.factor import extend_factors
from tox.config.loader.section import Section


class IniSection(Section):
    @classmethod
    def test_env(cls, name: str) -> IniSection:
        return cls(TEST_ENV_PREFIX, name)

    @property
    def is_test_env(self) -> bool:
        return self.prefix == TEST_ENV_PREFIX

    @property
    def names(self) -> list[str]:
        elements = list(extend_factors(self.name))
        return elements


TEST_ENV_PREFIX = "testenv"
CORE = IniSection(None, "tox")

__all__ = [
    "IniSection",
    "CORE",
    "TEST_ENV_PREFIX",
]