tox-dev / tox

@@ -1,10 +1,13 @@
Loading
1 +
from configparser import ConfigParser
1 2
from textwrap import dedent
2 -
from typing import List
3 +
from typing import Callable, List
3 4
4 5
import pytest
5 6
6 7
from tests.conftest import ToxIniCreator
8 +
from tox.config.loader.ini import IniLoader
7 9
from tox.config.loader.ini.factor import filter_for_env, find_envs
10 +
from tox.config.main import Config
8 11
9 12
10 13
def test_factor_env_discover_empty() -> None:
@@ -146,3 +149,24 @@
Loading
146 149
    )
147 150
148 151
    assert list(config) == ["py37-django15", "py37-django16", "py36"]
152 +
153 +
154 +
@pytest.mark.parametrize(
155 +
    ("env", "result"),
156 +
    [
157 +
        ("py35", "python -m coverage html -d cov"),
158 +
        ("py36", "python -m coverage html -d cov\n--show-contexts"),
159 +
    ],
160 +
)
161 +
def test_ini_loader_raw_with_factors(
162 +
    mk_ini_conf: Callable[[str], ConfigParser], env: str, result: str, empty_config: Config
163 +
) -> None:
164 +
    commands = "python -m coverage html -d cov \n    !py35: --show-contexts"
165 +
    loader = IniLoader(
166 +
        section="testenv",
167 +
        parser=mk_ini_conf(f"[tox]\nenvlist=py35,py36\n[testenv]\ncommands={commands}"),
168 +
        overrides=[],
169 +
        core_prefix="tox",
170 +
    )
171 +
    outcome = loader.load_raw(key="commands", conf=empty_config, env_name=env)
172 +
    assert outcome == result

@@ -0,0 +1,9 @@
Loading
1 +
import pytest
2 +
3 +
from tests.conftest import ToxIniCreator
4 +
from tox.config.main import Config
5 +
6 +
7 +
@pytest.fixture()
8 +
def empty_config(tox_ini_conf: ToxIniCreator) -> Config:
9 +
    return tox_ini_conf("")

@@ -30,10 +30,10 @@
Loading
30 30
31 31
    def load_raw(self, key: str, conf: Optional["Config"], env_name: Optional[str]) -> str:
32 32
        value = self._section[key]
33 -
        collapsed_newlines = value.replace("\r", "").replace("\\\n", "")  # collapse explicit new-line escape
33 +
34 34
        # strip comments
35 35
        elements: List[str] = []
36 -
        for line in collapsed_newlines.split("\n"):
36 +
        for line in value.split("\n"):
37 37
            if not line.startswith("#"):
38 38
                part = _COMMENTS.sub("", line)
39 39
                elements.append(part.replace("\\#", "#"))
@@ -43,7 +43,8 @@
Loading
43 43
            factor_filtered = strip_comments  # we don't support factor and replace functionality there
44 44
        else:
45 45
            factor_filtered = filter_for_env(strip_comments, env_name)  # select matching factors
46 -
        return factor_filtered
46 +
        collapsed = factor_filtered.replace("\r", "").replace("\\\n", "")  # collapse explicit new-line escape
47 +
        return collapsed
47 48
48 49
    @contextmanager
49 50
    def build(

@@ -1,5 +1,3 @@
Loading
1 -
import pytest
2 -
3 1
from tests.conftest import ToxIniCreator
4 2
from tox.config.loader.api import Override
5 3
from tox.config.loader.memory import MemoryLoader
@@ -7,11 +5,6 @@
Loading
7 5
from tox.config.sets import ConfigSet
8 6
9 7
10 -
@pytest.fixture()
11 -
def empty_config(tox_ini_conf: ToxIniCreator) -> Config:
12 -
    return tox_ini_conf("")
13 -
14 -
15 8
def test_empty_config_repr(empty_config: Config) -> None:
16 9
    text = repr(empty_config)
17 10
    assert str(empty_config.core["tox_root"]) in text
Files Coverage
src/tox 99.73%
tests 100.00%
Project Totals (152 files) 99.83%
3.9 - Windows
Build #747283346 -
tests
3.7 - MacOs
Build #747283346 -
tests
3.8 - MacOs
Build #747283346 -
tests
3.10.0-alpha.7 - Windows
Build #747283346 -
tests
3.9 - MacOs
Build #747283346 -
tests
3.8 - Ubuntu
Build #747283346 -
tests
3.7 - Ubuntu
Build #747283346 -
tests
3.6 - Ubuntu
Build #747283346 -
tests
3.9 - Ubuntu
Build #747283346 -
tests
3.10.0-alpha.7 - Ubuntu
Build #747283346 -
tests
3.6 - MacOs
Build #747283346 -
tests
3.10.0-alpha.7 - MacOs
Build #747283346 -
tests
3.6 - Windows
Build #747283346 -
tests
3.7 - Windows
Build #747283346 -
tests
3.8 - Windows
Build #747283346 -
tests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading