tox-dev / tox

Compare 8eb7b3a ... +0 ... cd0a1b6

Coverage Reach
src/tox/tox_env/python/pip/req/file.py src/tox/tox_env/python/pip/req/args.py src/tox/tox_env/python/pip/req/util.py src/tox/tox_env/python/pip/pip_install.py src/tox/tox_env/python/pip/req_file.py src/tox/tox_env/python/virtual_env/package/api.py src/tox/tox_env/python/virtual_env/api.py src/tox/tox_env/python/virtual_env/runner.py src/tox/tox_env/python/api.py src/tox/tox_env/python/runner.py src/tox/tox_env/python/package.py src/tox/tox_env/api.py src/tox/tox_env/runner.py src/tox/tox_env/package.py src/tox/tox_env/info.py src/tox/tox_env/register.py src/tox/tox_env/installer.py src/tox/tox_env/errors.py src/tox/config/loader/ini/replace.py src/tox/config/loader/ini/__init__.py src/tox/config/loader/ini/factor.py src/tox/config/loader/convert.py src/tox/config/loader/str_convert.py src/tox/config/loader/api.py src/tox/config/loader/memory.py src/tox/config/loader/stringify.py src/tox/config/cli/parser.py src/tox/config/cli/ini.py src/tox/config/cli/parse.py src/tox/config/cli/env_var.py src/tox/config/source/ini.py src/tox/config/source/discover.py src/tox/config/source/api.py src/tox/config/source/legacy_toml.py src/tox/config/source/setup_cfg.py src/tox/config/source/tox_ini.py src/tox/config/source/__init__.py src/tox/config/sets.py src/tox/config/main.py src/tox/config/of_type.py src/tox/config/set_env.py src/tox/config/types.py src/tox/session/cmd/run/common.py src/tox/session/cmd/run/single.py src/tox/session/cmd/run/parallel.py src/tox/session/cmd/run/sequential.py src/tox/session/cmd/show_config.py src/tox/session/cmd/legacy.py src/tox/session/cmd/list_env.py src/tox/session/cmd/depends.py src/tox/session/cmd/devenv.py src/tox/session/cmd/quickstart.py src/tox/session/cmd/version_flag.py src/tox/session/state.py src/tox/session/common.py src/tox/execute/local_sub_process/__init__.py src/tox/execute/local_sub_process/read_via_thread_windows.py src/tox/execute/local_sub_process/read_via_thread.py src/tox/execute/local_sub_process/read_via_thread_unix.py src/tox/execute/api.py src/tox/execute/stream.py src/tox/execute/pep517_backend.py src/tox/execute/request.py src/tox/execute/__init__.py src/tox/util/pep517/frontend.py src/tox/util/pep517/backend.py src/tox/util/pep517/via_fresh_subprocess.py src/tox/util/spinner.py src/tox/util/graph.py src/tox/util/cpu.py src/tox/pytest.py src/tox/report.py src/tox/plugin/manager.py src/tox/plugin/spec.py src/tox/plugin/inline.py src/tox/plugin/__init__.py src/tox/journal/env.py src/tox/journal/main.py src/tox/journal/__init__.py src/tox/provision.py src/tox/run.py src/tox/__init__.py tests/config/loader/ini/replace/test_replace_tox_env.py tests/config/loader/ini/replace/test_replace_posargs.py tests/config/loader/ini/replace/test_replace_env_var.py tests/config/loader/ini/replace/conftest.py tests/config/loader/ini/replace/test_replace_tty.py tests/config/loader/ini/replace/test_replace.py tests/config/loader/ini/replace/test_replace_os_sep.py tests/config/loader/ini/test_factor.py tests/config/loader/ini/test_ini_loader.py tests/config/loader/ini/conftest.py tests/config/loader/test_loader.py tests/config/loader/test_memory_loader.py tests/config/loader/test_str_convert.py tests/config/cli/test_cli_ini.py tests/config/cli/test_cli_env_var.py tests/config/cli/test_parser.py tests/config/cli/conftest.py tests/config/cli/test_parse.py tests/config/test_sets.py tests/config/test_set_env.py tests/config/source/test_discover.py tests/config/source/test_setup_cfg.py tests/config/source/test_tox_ini.py tests/config/source/test_legacy_toml.py tests/config/test_main.py tests/config/test_types.py tests/config/test_of_types.py tests/config/conftest.py tests/tox_env/python/pip/test_pip_install.py tests/tox_env/python/pip/req/test_file.py tests/tox_env/python/pip/test_req_file.py tests/tox_env/python/virtual_env/test_virtualenv_api.py tests/tox_env/python/virtual_env/test_package.py tests/tox_env/python/virtual_env/test_setuptools.py tests/tox_env/python/test_python_runner.py tests/tox_env/python/test_python_api.py tests/tox_env/test_register.py tests/tox_env/test_tox_env_api.py tests/tox_env/test_info.py tests/session/cmd/test_sequential.py tests/session/cmd/test_show_config.py tests/session/cmd/test_parallel.py tests/session/cmd/test_legacy.py tests/session/cmd/run/test_common.py tests/session/cmd/test_list_envs.py tests/session/cmd/test_depends.py tests/session/cmd/test_quickstart.py tests/session/cmd/test_devenv.py tests/session/cmd/test_state.py tests/session/test_session_common.py tests/util/test_pep517.py tests/util/test_spinner.py tests/util/test_graph.py tests/util/test_cpu.py tests/execute/local_subprocess/test_local_subprocess.py tests/execute/local_subprocess/local_subprocess_sigint.py tests/execute/local_subprocess/tty_check.py tests/execute/test_request.py tests/execute/conftest.py tests/execute/test_stream.py tests/test_provision.py tests/pytest_/test_init.py tests/conftest.py tests/test_report.py tests/journal/test_main_journal.py tests/demo_pkg_inline/build.py tests/test_run.py tests/plugin/test_inline.py tests/test_call_modes.py tests/test_version.py

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.


@@ -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,17 +1,10 @@
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
6 4
from tox.config.main import Config
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

Learn more Showing 9 files with coverage changes found.

Changes in src/tox/execute/local_sub_process/__init__.py
+13
+5
+2
Loading file...
Changes in src/tox/util/spinner.py
+13
+3
Loading file...
Changes in src/tox/config/loader/str_convert.py
+5
+1
Loading file...
Changes in src/tox/tox_env/python/api.py
+1
+1
Loading file...
Changes in src/tox/tox_env/api.py
+2
Loading file...
Changes in src/tox/execute/request.py
+3
Loading file...
Changes in src/tox/util/pep517/backend.py
+2
Loading file...
New file src/tox/execute/local_sub_process/read_via_thread_windows.py
New
Loading file...
New file tests/config/conftest.py
New
Loading file...
Files Coverage
src/tox -0.27% 99.73%
tests 100.00%
Project Totals (152 files) 99.83%
Loading