From 4e233bf946e6c6931e71dbf8f76ab848b0dd64dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 30 Oct 2023 12:04:46 -0700 Subject: [PATCH] Fix native toml documentation does not match code (#60) --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 2 +- src/pytest_env/plugin.py | 2 +- tests/test_env.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 396d99b..6b973dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.1" + rev: "v0.1.3" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -19,7 +19,7 @@ repos: - id: tox-ini-fmt args: ["-p", "fix"] - repo: https://github.com/tox-dev/pyproject-fmt - rev: "1.2.0" + rev: "1.3.0" hooks: - id: pyproject-fmt additional_dependencies: ["tox>=4.11.3"] diff --git a/pyproject.toml b/pyproject.toml index 4a8ec77..682d799 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ dynamic = [ "version", ] dependencies = [ - "pytest>=7.4.2", + "pytest>=7.4.3", 'tomli>=2.0.1; python_version < "3.11"', ] optional-dependencies.test = [ diff --git a/src/pytest_env/plugin.py b/src/pytest_env/plugin.py index 54a81f7..e9d926d 100644 --- a/src/pytest_env/plugin.py +++ b/src/pytest_env/plugin.py @@ -54,7 +54,7 @@ def _load_values(early_config: pytest.Config) -> Iterator[Entry]: config = tomllib.load(file_handler) if "tool" in config and "pytest_env" in config["tool"]: has_toml_conf = True - for key, entry in config["tool"]["pytest_env"].get("env", {}).items(): + for key, entry in config["tool"]["pytest_env"].items(): if isinstance(entry, dict): value = str(entry["value"]) transform, skip_if_set = bool(entry.get("transform")), bool(entry.get("skip_if_set")) diff --git a/tests/test_env.py b/tests/test_env.py index 90097b8..a9d7367 100644 --- a/tests/test_env.py +++ b/tests/test_env.py @@ -137,21 +137,21 @@ def test_env_via_pytest( ), pytest.param( {}, - '[tool.pytest_env.env]\nMAGIC = 1\nMAGIC_2 = "toml2"', + '[tool.pytest_env]\nMAGIC = 1\nMAGIC_2 = "toml2"', "", {"MAGIC": "1", "MAGIC_2": "toml2"}, id="toml native", ), pytest.param( {}, - '[tool.pytest_env.env]\nMAGIC = 1\nMAGIC_2 = "toml2"', + '[tool.pytest_env]\nMAGIC = 1\nMAGIC_2 = "toml2"', "[pytest]\nenv = MAGIC=ini\n MAGIC_2=ini2", {"MAGIC": "1", "MAGIC_2": "toml2"}, id="toml native over ini", ), pytest.param( {}, - '[tool.pytest_env.env]\nMAGIC = {value = "toml", "transform"= true, "skip_if_set" = true}', + '[tool.pytest_env]\nMAGIC = {value = "toml", "transform"= true, "skip_if_set" = true}', "", {"MAGIC": "toml"}, id="toml inline table",