diff --git a/CHANGES.rst b/CHANGES.rst index d74840d..85ec2e4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,7 +6,10 @@ CHANGES 6.1 (unreleased) ================ -- Nothing changed yet. +- Fix installed module name + (`#7 `_) +- Replace deprecated ``pkg_resources`` with ``importlib.metdata`` + 6.0 (2023-07-07) diff --git a/plugin.py b/pytest_remove_stale_bytecode.py similarity index 88% rename from plugin.py rename to pytest_remove_stale_bytecode.py index 5c63b3c..1825625 100644 --- a/plugin.py +++ b/pytest_remove_stale_bytecode.py @@ -1,13 +1,12 @@ +import importlib.metadata import os import os.path -import pkg_resources import sys -__version__ = pkg_resources.get_distribution( - 'pytest-remove-stale-bytecode').version +__version__ = importlib.metadata.version('pytest-remove-stale-bytecode') python_version = '{0.major}{0.minor}'.format(sys.version_info) -pytest_version = pkg_resources.get_distribution('pytest').version +pytest_version = importlib.metadata.version('pytest') compiled_suffixes = '.pyc', '.pyo' diff --git a/setup.py b/setup.py index 5543355..8634cb3 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ def project_path(*names): install_requires=[ 'pytest', - 'setuptools', ], extras_require={ @@ -27,7 +26,7 @@ def project_path(*names): entry_points={ 'pytest11': [ - 'removestalebytecode = plugin', + 'removestalebytecode = pytest_remove_stale_bytecode', ], }, @@ -64,5 +63,5 @@ def project_path(*names): )), zip_safe=False, - py_modules=['plugin'], + py_modules=['pytest_remove_stale_bytecode'], ) diff --git a/test_plugin.py b/test_plugin.py index f07ee4e..569066d 100644 --- a/test_plugin.py +++ b/test_plugin.py @@ -1,5 +1,5 @@ -from plugin import pytest_version -from plugin import python_version +from pytest_remove_stale_bytecode import pytest_version +from pytest_remove_stale_bytecode import python_version from unittest import mock import pytest @@ -8,8 +8,8 @@ def test_version(): - import plugin - assert plugin.__version__ + import pytest_remove_stale_bytecode + assert pytest_remove_stale_bytecode.__version__ @pytest.mark.parametrize("ext", ['.pyc', '.pyo']) @@ -116,6 +116,6 @@ def test_plugin_removes_python3_PYTEST_bytecode_files(testdir, ext): def test_plugin_does_not_break_if_file_is_removed_externally(testdir): bar = testdir.makefile('.pyc', bar='') - with mock.patch('plugin.delete_file', side_effect=FileNotFoundError): + with mock.patch('pytest_remove_stale_bytecode.delete_file', side_effect=FileNotFoundError): testdir.runpytest("-v") assert bar.exists()