Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy support #7

Merged
merged 2 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v2.0.0
======

#4: Remove compatibility shim. ``[pytest.enabler]`` is no longer
supported.

v1.3.1
======

Expand Down
14 changes: 1 addition & 13 deletions pytest_enabler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import contextlib
import shlex
import sys
import warnings

import toml
from jaraco.context import suppress
Expand All @@ -25,18 +24,7 @@ def none_as_empty(ob):
def read_plugins(filename):
with open(filename) as strm:
defn = toml.load(strm)
return _read_plugins_legacy(defn) or defn["tool"]["pytest-enabler"]


@suppress(KeyError)
def _read_plugins_legacy(defn):
value = defn["pytest"]["enabler"]
msg = (
"pytest-enabler configuration should use the `[tool.pytest-enabler]` "
"table in pyproject.toml (`[pytest.enabler]` is now deprecated)."
)
warnings.warn(msg, DeprecationWarning)
return value
return defn["tool"]["pytest-enabler"]


def pytest_load_initial_conftests(early_config, parser, args):
Expand Down
17 changes: 0 additions & 17 deletions tests/test_enabler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,6 @@ def test_pytest_addoption(tmpdir_cur):
assert args == ['--black']


def test_pytest_addoption_legacy(tmpdir_cur):
pathlib.Path('pyproject.toml').write_text(
textwrap.dedent(
"""
[pytest.enabler.black]
addopts = "--black"
"""
)
)
config = mock.MagicMock()
config.pluginmanager.has_plugin = lambda name: name == 'black'
args = []
with pytest.warns(DeprecationWarning):
enabler.pytest_load_initial_conftests(config, None, args)
assert args == ['--black']


def test_remove_deps(monkeypatch):
"""
Invoke _remove_deps to push coverage.
Expand Down