Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pytest-env for 
openSUSE:Factory checked in at 2023-11-08 22:17:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-env (Old)
 and      /work/SRC/openSUSE:Factory/.python-pytest-env.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pytest-env"

Wed Nov  8 22:17:11 2023 rev:6 rq:1124084 version:1.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pytest-env/python-pytest-env.changes      
2023-07-26 13:21:46.779257498 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pytest-env.new.17445/python-pytest-env.changes
   2023-11-08 22:17:28.834628029 +0100
@@ -1,0 +2,10 @@
+Tue Nov  7 19:38:22 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.1.1:
+  * Fix native toml documentation does not match code
+  * Fix type checker
+  * Drop the pytest dot
+  * Add native toml support
+  * Disable plugin autoloading in the test suite
+
+-------------------------------------------------------------------

Old:
----
  pytest_env-0.8.2.tar.gz

New:
----
  pytest_env-1.1.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pytest-env.spec ++++++
--- /var/tmp/diff_new_pack.pzusV0/_old  2023-11-08 22:17:29.394648602 +0100
+++ /var/tmp/diff_new_pack.pzusV0/_new  2023-11-08 22:17:29.398648749 +0100
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-pytest-env
-Version:        0.8.2
+Version:        1.1.1
 Release:        0
 Summary:        Pytest plugin to add environment variables
 License:        MIT

++++++ pytest_env-0.8.2.tar.gz -> pytest_env-1.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/.github/release.yml 
new/pytest_env-1.1.1/.github/release.yml
--- old/pytest_env-0.8.2/.github/release.yml    1970-01-01 01:00:00.000000000 
+0100
+++ new/pytest_env-1.1.1/.github/release.yml    2020-02-02 01:00:00.000000000 
+0100
@@ -0,0 +1,5 @@
+changelog:
+  exclude:
+    authors:
+      - dependabot
+      - pre-commit-ci
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/.github/workflows/check.yml 
new/pytest_env-1.1.1/.github/workflows/check.yml
--- old/pytest_env-0.8.2/.github/workflows/check.yml    2020-02-02 
01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/.github/workflows/check.yml    2020-02-02 
01:00:00.000000000 +0100
@@ -18,12 +18,11 @@
       fail-fast: false
       matrix:
         py:
-          - "3.12.0-beta.2"
+          - "3.12.0-rc.1"
           - "3.11"
           - "3.10"
           - "3.9"
           - "3.8"
-          - "3.7"
         os:
           - ubuntu-latest
 
@@ -34,7 +33,7 @@
           python-version: "3.11"
       - name: Install tox
         run: python -m pip install tox
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           fetch-depth: 0
       - name: Setup python for test ${{ matrix.py }}
@@ -69,7 +68,7 @@
           - type
           - readme
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           fetch-depth: 0
       - name: Setup Python "3.11"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/.github/workflows/release.yml 
new/pytest_env-1.1.1/.github/workflows/release.yml
--- old/pytest_env-0.8.2/.github/workflows/release.yml  2020-02-02 
01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/.github/workflows/release.yml  2020-02-02 
01:00:00.000000000 +0100
@@ -18,10 +18,10 @@
           python-version: "3.11"
       - name: Install build
         run: python -m pip install build
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           fetch-depth: 0
       - name: Build package
         run: pyproject-build -s -w . -o dist
       - name: Publish to PyPI
-        uses: pypa/gh-action-pypi-publish@v1.8.6
+        uses: pypa/gh-action-pypi-publish@v1.8.10
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/.pre-commit-config.yaml 
new/pytest_env-1.1.1/.pre-commit-config.yaml
--- old/pytest_env-0.8.2/.pre-commit-config.yaml        2020-02-02 
01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/.pre-commit-config.yaml        2020-02-02 
01:00:00.000000000 +0100
@@ -1,30 +1,30 @@
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.4.0
+    rev: v4.5.0
     hooks:
       - id: end-of-file-fixer
       - id: trailing-whitespace
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: "v0.0.272"
+    rev: "v0.1.3"
     hooks:
       - id: ruff
         args: [--fix, --exit-non-zero-on-fix]
   - repo: https://github.com/psf/black
-    rev: 23.3.0
+    rev: 23.10.1
     hooks:
       - id: black
   - repo: https://github.com/tox-dev/tox-ini-fmt
-    rev: "1.3.0"
+    rev: "1.3.1"
     hooks:
       - id: tox-ini-fmt
         args: ["-p", "fix"]
   - repo: https://github.com/tox-dev/pyproject-fmt
-    rev: "0.11.2"
+    rev: "1.3.0"
     hooks:
       - id: pyproject-fmt
-        additional_dependencies: ["tox>=4.6"]
+        additional_dependencies: ["tox>=4.11.3"]
   - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: "v3.0.0-alpha.9-for-vscode"
+    rev: "v3.0.3"
     hooks:
       - id: prettier
         args: ["--print-width=120", "--prose-wrap=always"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/PKG-INFO 
new/pytest_env-1.1.1/PKG-INFO
--- old/pytest_env-0.8.2/PKG-INFO       2020-02-02 01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/PKG-INFO       2020-02-02 01:00:00.000000000 +0100
@@ -1,7 +1,7 @@
 Metadata-Version: 2.1
 Name: pytest-env
-Version: 0.8.2
-Summary: py.test plugin that allows you to add environment variables.
+Version: 1.1.1
+Summary: pytest plugin that allows you to add environment variables.
 Project-URL: Homepage, https://github.com/pytest-dev/pytest-env
 Project-URL: Source, https://github.com/pytest-dev/pytest-env
 Project-URL: Tracker, https://github.com/pytest-dev/pytest-env/issues
@@ -35,7 +35,6 @@
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
@@ -43,11 +42,13 @@
 Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=3.7
-Requires-Dist: pytest>=7.3.1
+Requires-Python: >=3.8
+Requires-Dist: pytest>=7.4.3
+Requires-Dist: tomli>=2.0.1; python_version < '3.11'
 Provides-Extra: test
-Requires-Dist: coverage>=7.2.7; extra == 'test'
-Requires-Dist: pytest-mock>=3.10; extra == 'test'
+Requires-Dist: covdefaults>=2.3; extra == 'test'
+Requires-Dist: coverage>=7.3.2; extra == 'test'
+Requires-Dist: pytest-mock>=3.12; extra == 'test'
 Description-Content-Type: text/markdown
 
 # pytest-env
@@ -58,7 +59,7 @@
 
[![check](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yml/badge.svg)](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yml)
 [![Code style:
 
black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
-[![Downloads](https://pepy.tech/badge/pytest-env/month)](https://pepy.tech/project/pytest-env/month)
+[![Downloads](https://static.pepy.tech/badge/pytest-env/month)](https://pepy.tech/project/pytest-env)
 
 This is a `pytest` plugin that enables you to set environment variables in a 
`pytest.ini` or `pyproject.toml` file.
 
@@ -72,6 +73,25 @@
 
 ## Usage
 
+### Native form in `pyproject.toml`
+
+```toml
+[tool.pytest_env]
+HOME = "~/tmp"
+RUN_ENV = 1
+TRANSFORMED = {value = "{USER}/alpha", transform: true}
+SKIP_IF_SET = {value = "on", skip_if_set: true}
+```
+
+The `tool.pytest_env` tables keys are the environment variables keys to set. 
The right hands-ide of the assigment:
+
+- if an inline table you can set options via the `transform` or `skip_if_set` 
keys, while the `value` key holds the
+  value to set (or transform before setting). For transformation the variables 
you can use is other environment
+  variable,
+- otherwise the value to set for the environment variable to set (casted to a 
string).
+
+### Via pytest configurations
+
 In your pytest.ini file add a key value pair with `env` as the key and the 
environment variables as a line separated
 list of `KEY=VALUE` entries. The defined variables will be added to the 
environment before any tests are run:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/README.md 
new/pytest_env-1.1.1/README.md
--- old/pytest_env-0.8.2/README.md      2020-02-02 01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/README.md      2020-02-02 01:00:00.000000000 +0100
@@ -6,7 +6,7 @@
 
[![check](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yml/badge.svg)](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yml)
 [![Code style:
 
black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
-[![Downloads](https://pepy.tech/badge/pytest-env/month)](https://pepy.tech/project/pytest-env/month)
+[![Downloads](https://static.pepy.tech/badge/pytest-env/month)](https://pepy.tech/project/pytest-env)
 
 This is a `pytest` plugin that enables you to set environment variables in a 
`pytest.ini` or `pyproject.toml` file.
 
@@ -20,6 +20,25 @@
 
 ## Usage
 
+### Native form in `pyproject.toml`
+
+```toml
+[tool.pytest_env]
+HOME = "~/tmp"
+RUN_ENV = 1
+TRANSFORMED = {value = "{USER}/alpha", transform: true}
+SKIP_IF_SET = {value = "on", skip_if_set: true}
+```
+
+The `tool.pytest_env` tables keys are the environment variables keys to set. 
The right hands-ide of the assigment:
+
+- if an inline table you can set options via the `transform` or `skip_if_set` 
keys, while the `value` key holds the
+  value to set (or transform before setting). For transformation the variables 
you can use is other environment
+  variable,
+- otherwise the value to set for the environment variable to set (casted to a 
string).
+
+### Via pytest configurations
+
 In your pytest.ini file add a key value pair with `env` as the key and the 
environment variables as a line separated
 list of `KEY=VALUE` entries. The defined variables will be added to the 
environment before any tests are run:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/pyproject.toml 
new/pytest_env-1.1.1/pyproject.toml
--- old/pytest_env-0.8.2/pyproject.toml 2020-02-02 01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100
@@ -2,12 +2,12 @@
 build-backend = "hatchling.build"
 requires = [
   "hatch-vcs>=0.3",
-  "hatchling>=1.17.1",
+  "hatchling>=1.18",
 ]
 
 [project]
 name = "pytest-env"
-description = "py.test plugin that allows you to add environment variables."
+description = "pytest plugin that allows you to add environment variables."
 readme = "README.md"
 keywords = [
   "env",
@@ -15,7 +15,7 @@
 ]
 license.file = "LICENSE"
 maintainers = [{ name = "Bernát Gábor", email = "gaborjber...@gmail.com" }]
-requires-python = ">=3.7"
+requires-python = ">=3.8"
 classifiers = [
   "Development Status :: 5 - Production/Stable",
   "Intended Audience :: Developers",
@@ -23,7 +23,6 @@
   "Operating System :: OS Independent",
   "Programming Language :: Python",
   "Programming Language :: Python :: 3 :: Only",
-  "Programming Language :: Python :: 3.7",
   "Programming Language :: Python :: 3.8",
   "Programming Language :: Python :: 3.9",
   "Programming Language :: Python :: 3.10",
@@ -36,11 +35,13 @@
   "version",
 ]
 dependencies = [
-  "pytest>=7.3.1",
+  "pytest>=7.4.3",
+  'tomli>=2.0.1; python_version < "3.11"',
 ]
 optional-dependencies.test = [
-  "coverage>=7.2.7",
-  "pytest-mock>=3.10",
+  "covdefaults>=2.3",
+  "coverage>=7.3.2",
+  "pytest-mock>=3.12",
 ]
 urls.Homepage = "https://github.com/pytest-dev/pytest-env";
 urls.Source = "https://github.com/pytest-dev/pytest-env";
@@ -55,6 +56,28 @@
 [tool.black]
 line-length = 120
 
+[tool.ruff]
+select = ["ALL"]
+line-length = 120
+target-version = "py38"
+isort = {known-first-party = ["pytest_env"], required-imports = ["from 
__future__ import annotations"]}
+ignore = [
+  "ANN101",  # no type annotation for self
+  "ANN401",  # allow Any as type annotation
+  "D203",  # `one-blank-line-before-class` (D203) and 
`no-blank-line-before-class` (D211) are incompatible
+  "D212",  # `multi-line-summary-first-line` (D212) and 
`multi-line-summary-second-line` (D213) are incompatible
+  "S104",  # Possible binding to all interface
+]
+[tool.ruff.per-file-ignores]
+"tests/**/*.py" = [
+  "S101",  # asserts allowed in tests...
+  "FBT",  # don"t care about booleans as positional arguments in tests
+  "INP001", # no implicit namespace
+  "D",  # don"t care about documentation in tests
+  "S603",  # `subprocess` call: check for execution of untrusted input
+  "PLR2004",  # Magic value used in comparison, consider replacing with a 
constant variable
+]
+
 [tool.isort]
 profile = "black"
 known_first_party = ["pytest_env"]
@@ -64,7 +87,8 @@
 run.dynamic_context = "test_function"
 run.branch = true
 run.parallel = true
-report.fail_under = 92
+run.plugins = ["covdefaults"]
+report.fail_under = 100
 report.show_missing = true
 html.show_contexts = true
 html.skip_covered = false
@@ -78,28 +102,6 @@
 ]
 
 [tool.mypy]
-python_version = "3.10"
+python_version = "3.11"
 show_error_codes = true
 strict = true
-
-[tool.ruff]
-select = ["ALL"]
-line-length = 120
-target-version = "py37"
-isort = {known-first-party = ["pytest_env"], required-imports = ["from 
__future__ import annotations"]}
-ignore = [
-  "ANN101",  # no typoe annotation for self
-  "ANN401",  # allow Any as type annotation
-  "D203",  # `one-blank-line-before-class` (D203) and 
`no-blank-line-before-class` (D211) are incompatible
-  "D212",  # `multi-line-summary-first-line` (D212) and 
`multi-line-summary-second-line` (D213) are incompatible
-  "S104",  # Possible binding to all interface
-]
-[tool.ruff.per-file-ignores]
-"tests/**/*.py" = [
-  "S101",  # asserts allowed in tests...
-  "FBT",  # don"t care about booleans as positional arguments in tests
-  "INP001", # no implicit namespace
-  "D",  # don"t care about documentation in tests
-  "S603",  # `subprocess` call: check for execution of untrusted input
-  "PLR2004",  # Magic value used in comparison, consider replacing with a 
constant variable
-]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/src/pytest_env/plugin.py 
new/pytest_env-1.1.1/src/pytest_env/plugin.py
--- old/pytest_env-0.8.2/src/pytest_env/plugin.py       2020-02-02 
01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/src/pytest_env/plugin.py       2020-02-02 
01:00:00.000000000 +0100
@@ -2,9 +2,18 @@
 from __future__ import annotations
 
 import os
+import sys
+from dataclasses import dataclass
+from itertools import chain
+from typing import Iterator
 
 import pytest
 
+if sys.version_info >= (3, 11):  # pragma: >=3.11 cover
+    import tomllib
+else:  # pragma: <3.11 cover
+    import tomli as tomllib
+
 
 def pytest_addoption(parser: pytest.Parser) -> None:
     """Add section to configuration files."""
@@ -12,26 +21,58 @@
     parser.addini("env", type="linelist", help=help_msg, default=[])
 
 
-@pytest.hookimpl(tryfirst=True)  # type: ignore[misc]
+@dataclass
+class Entry:
+    """Configuration entries."""
+
+    key: str
+    value: str
+    transform: bool
+    skip_if_set: bool
+
+
+@pytest.hookimpl(tryfirst=True)
 def pytest_load_initial_conftests(
     args: list[str],  # noqa: ARG001
     early_config: pytest.Config,
     parser: pytest.Parser,  # noqa: ARG001
 ) -> None:
     """Load environment variables from configuration files."""
-    for line in early_config.getini("env"):
-        # INI lines e.g. D:R:NAME=VAL has two flags (R and D), NAME key, and 
VAL value
-        parts = line.partition("=")
-        ini_key_parts = parts[0].split(":")
-        flags = {k.strip().upper() for k in ini_key_parts[:-1]}
-        # R: is a way to designate whether to use raw value -> perform no 
transformation of the value
-        transform = "R" not in flags
-        # D: is a way to mark the value to be set only if it does not exist yet
-        skip_if_set = "D" in flags
-        key = ini_key_parts[-1].strip()
-        value = parts[2].strip()
-
-        if skip_if_set and key in os.environ:
+    for entry in _load_values(early_config):
+        if entry.skip_if_set and entry.key in os.environ:
             continue
         # transformation -> replace environment variables, e.g. 
TEST_DIR={USER}/repo_test_dir.
-        os.environ[key] = value.format(**os.environ) if transform else value
+        os.environ[entry.key] = entry.value.format(**os.environ) if 
entry.transform else entry.value
+
+
+def _load_values(early_config: pytest.Config) -> Iterator[Entry]:
+    has_toml_conf = False
+    for path in chain.from_iterable([[early_config.rootpath], 
early_config.rootpath.parents]):
+        toml_file = path / "pyproject.toml"
+        if toml_file.exists():
+            with toml_file.open("rb") as file_handler:
+                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"].items():
+                        if isinstance(entry, dict):
+                            value = str(entry["value"])
+                            transform, skip_if_set = 
bool(entry.get("transform")), bool(entry.get("skip_if_set"))
+                        else:
+                            value, transform, skip_if_set = str(entry), False, 
False
+                        yield Entry(key, value, transform, skip_if_set)
+            break
+
+    if not has_toml_conf:
+        for line in early_config.getini("env"):
+            # INI lines e.g. D:R:NAME=VAL has two flags (R and D), NAME key, 
and VAL value
+            parts = line.partition("=")
+            ini_key_parts = parts[0].split(":")
+            flags = {k.strip().upper() for k in ini_key_parts[:-1]}
+            # R: is a way to designate whether to use raw value -> perform no 
transformation of the value
+            transform = "R" not in flags
+            # D: is a way to mark the value to be set only if it does not 
exist yet
+            skip_if_set = "D" in flags
+            key = ini_key_parts[-1].strip()
+            value = parts[2].strip()
+            yield Entry(key, value, transform, skip_if_set)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/src/pytest_env/version.py 
new/pytest_env-1.1.1/src/pytest_env/version.py
--- old/pytest_env-0.8.2/src/pytest_env/version.py      2020-02-02 
01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/src/pytest_env/version.py      2020-02-02 
01:00:00.000000000 +0100
@@ -1,4 +1,16 @@
 # file generated by setuptools_scm
 # don't change, don't track in version control
-__version__ = version = '0.8.2'
-__version_tuple__ = version_tuple = (0, 8, 2)
+TYPE_CHECKING = False
+if TYPE_CHECKING:
+    from typing import Tuple, Union
+    VERSION_TUPLE = Tuple[Union[int, str], ...]
+else:
+    VERSION_TUPLE = object
+
+version: str
+__version__: str
+__version_tuple__: VERSION_TUPLE
+version_tuple: VERSION_TUPLE
+
+__version__ = version = '1.1.1'
+__version_tuple__ = version_tuple = (1, 1, 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/tests/test_env.py 
new/pytest_env-1.1.1/tests/test_env.py
--- old/pytest_env-0.8.2/tests/test_env.py      2020-02-02 01:00:00.000000000 
+0100
+++ new/pytest_env-1.1.1/tests/test_env.py      2020-02-02 01:00:00.000000000 
+0100
@@ -92,7 +92,7 @@
         ),
     ],
 )
-def test_env(
+def test_env_via_pytest(
     testdir: pytest.Testdir,
     env: dict[str, str],
     ini: str,
@@ -104,8 +104,96 @@
     Path(str(tmp_dir / 
f"test_{test_name}.py")).symlink_to(Path(__file__).parent / "template.py")
     (tmp_dir / "pytest.ini").write_text(ini, encoding="utf-8")
 
+    new_env = {
+        **env,
+        "_TEST_ENV": repr(expected_env),
+        "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1",
+        "PYTEST_PLUGINS": "pytest_env.plugin",
+    }
+
+    # monkeypatch persists env variables across parametrized tests, therefore 
using mock.patch.dict
+    with mock.patch.dict(os.environ, new_env, clear=True):
+        result = testdir.runpytest()
+
+    result.assert_outcomes(passed=1)
+
+
+@pytest.mark.parametrize(
+    ("env", "toml", "ini", "expected_env"),
+    [
+        pytest.param(
+            {},
+            '[tool.pytest.ini_options]\nenv = ["MAGIC=toml", "MAGIC_2=toml2"]',
+            "[pytest]\nenv = MAGIC=ini\n MAGIC_2=ini2",
+            {"MAGIC": "ini", "MAGIC_2": "ini2"},
+            id="ini over toml ini_options",
+        ),
+        pytest.param(
+            {},
+            '[tool.pytest.ini_options]\nenv = ["MAGIC=toml", "MAGIC_2=toml2"]',
+            "",
+            {"MAGIC": "toml", "MAGIC_2": "toml2"},
+            id="toml via ini_options",
+        ),
+        pytest.param(
+            {},
+            '[tool.pytest_env]\nMAGIC = 1\nMAGIC_2 = "toml2"',
+            "",
+            {"MAGIC": "1", "MAGIC_2": "toml2"},
+            id="toml native",
+        ),
+        pytest.param(
+            {},
+            '[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]\nMAGIC = {value = "toml", "transform"= true, 
"skip_if_set" = true}',
+            "",
+            {"MAGIC": "toml"},
+            id="toml inline table",
+        ),
+    ],
+)
+def test_env_via_toml(  # noqa: PLR0913
+    testdir: pytest.Testdir,
+    env: dict[str, str],
+    toml: str,
+    ini: str,
+    expected_env: dict[str, str],
+    request: pytest.FixtureRequest,
+) -> None:
+    tmp_dir = Path(str(testdir.tmpdir))
+    test_name = re.sub(r"\W|^(?=\d)", "_", request.node.callspec.id).lower()
+    Path(str(tmp_dir / 
f"test_{test_name}.py")).symlink_to(Path(__file__).parent / "template.py")
+    if ini:
+        (tmp_dir / "pytest.ini").write_text(ini, encoding="utf-8")
+    (tmp_dir / "pyproject.toml").write_text(toml, encoding="utf-8")
+
+    new_env = {
+        **env,
+        "_TEST_ENV": repr(expected_env),
+        "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1",
+        "PYTEST_PLUGINS": "pytest_env.plugin",
+    }
+
     # monkeypatch persists env variables across parametrized tests, therefore 
using mock.patch.dict
-    with mock.patch.dict(os.environ, {**env, "_TEST_ENV": repr(expected_env)}, 
clear=True):
+    with mock.patch.dict(os.environ, new_env, clear=True):
         result = testdir.runpytest()
 
     result.assert_outcomes(passed=1)
+
+
+def test_env_via_toml_bad(testdir: pytest.Testdir) -> None:
+    toml_file = Path(str(testdir.tmpdir)) / "pyproject.toml"
+    toml_file.write_text("bad toml", encoding="utf-8")
+
+    result = testdir.runpytest()
+    assert result.ret == 4
+    assert result.errlines == [
+        f"ERROR: {toml_file}: Expected '=' after a key in a key/value pair (at 
line 1, column 5)",
+        "",
+    ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest_env-0.8.2/tox.ini new/pytest_env-1.1.1/tox.ini
--- old/pytest_env-0.8.2/tox.ini        2020-02-02 01:00:00.000000000 +0100
+++ new/pytest_env-1.1.1/tox.ini        2020-02-02 01:00:00.000000000 +0100
@@ -8,7 +8,6 @@
     py310
     py39
     py38
-    py37
     type
     readme
 skip_missing_interpreters = true
@@ -44,7 +43,7 @@
 [testenv:type]
 description = run type check on code base
 deps =
-    mypy==1.3
+    mypy==1.6.1
 set_env =
     {tty:MYPY_FORCE_COLOR = 1}
 commands =
@@ -55,7 +54,7 @@
 description = check that the long description is valid
 skip_install = true
 deps =
-    build[virtualenv]>=0.10
+    build[virtualenv]>=1.0.3
     twine>=4.0.2
 change_dir = {toxinidir}
 commands =
@@ -70,9 +69,3 @@
 commands =
     python -m pip list --format=columns
     python -c 'import sys; print(sys.executable)'
-
-[flake8]
-max-complexity = 22
-max-line-length = 120
-noqa-require-code = true
-dictionaries = en_US,python,technical,django

Reply via email to