Skip to content

Commit

Permalink
Remove legacy support. Ref #4
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 22, 2022
1 parent 5806cc0 commit d435679
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
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.0
======

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

0 comments on commit d435679

Please sign in to comment.