Repository: Gatewatcher/pytest-vulture (language: python)

Issue:
ref #17: update pyproject.toml for pypi



Discussion / hints:

Fix patch:
diff --git a/pyproject.toml b/pyproject.toml
index f5a8cec..aba442b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
 
 [project]
 name = "pytest-vulture"
-version = "2.2.1"
+version = "2.2.2"
 description = "A pytest plugin to checks dead code with vulture"
 readme = "README.rst"
 requires-python = ">=3.7"


Test patch:
diff --git a/src/pytest_vulture/__init__.py b/src/pytest_vulture/__init__.py
index fec55ab..87134c3 100644
--- a/src/pytest_vulture/__init__.py
+++ b/src/pytest_vulture/__init__.py
@@ -3,7 +3,7 @@
 __all__ = ["VultureError"]
 
 
-class VultureError(Exception):
+class VultureError(Exception):  # pragma: no cover
     """Any pytest vulture exception."""
 
     __message: str
diff --git a/src/pytest_vulture/conf/package.py b/src/pytest_vulture/conf/package.py
index b3cc243..88dda7d 100644
--- a/src/pytest_vulture/conf/package.py
+++ b/src/pytest_vulture/conf/package.py
@@ -52,7 +52,7 @@ def read_tomli(self, data: dict) -> None:
 
         str_source = parameters.get("source-path")
         self._source_path = Path(str_source) if str_source else Path()
-        self._check_entry_points = data.get("check-entry-points", True)
+        self._check_entry_points = bool(parameters.get("check-entry-points", True))
 
     def read_ini(self, config: ConfigParser) -> None:
         """Read the ini file."""
diff --git a/src/pytest_vulture/setup_manager.py b/src/pytest_vulture/setup_manager.py
index 58b2d1e..efd4d62 100644
--- a/src/pytest_vulture/setup_manager.py
+++ b/src/pytest_vulture/setup_manager.py
@@ -1,6 +1,7 @@
 """Manages the setup.py to get the entrypoint (and ignore then for vulture)."""
 
 import re
+import warnings
 from ast import literal_eval
 from contextlib import suppress
 from pathlib import Path
@@ -11,22 +12,9 @@
 
 from vulture.core import Item
 
-from pytest_vulture import VultureError
 from pytest_vulture.conf.reader import IniReader
 
 
-class EntryPointFileError(VultureError):
-    """Entrypoint file error."""
-
-    _name = "an entry point file is missing in the setup.py/pyproject.toml file"
-
-
-class EntryPointFunctionError(VultureError):
-    """Entrypoint function error."""
-
-    _name = "an entry point function is missing in the setup.py/pyproject.toml file"
-
-
 _ENTRY_POINT_MSG = "\nYou can add the source_path parameter in the settings or disable with check-entry-points=0"
 
 
@@ -148,11 +136,14 @@ def __check_entry_points(self) -> None:
             else:
                 path = (dir_path / (str(new_path) + ".py")).absolute()
             if not path.exists():
-                raise EntryPointFileError(message=f"{path.as_posix()} can not be found. {_ENTRY_POINT_MSG}")
+                msg = f"{path.as_posix()} can not be found. {_ENTRY_POINT_MSG}"
+                warnings.warn(UserWarning(msg), stacklevel=2)
+                continue
             with path.open() as file:
                 content = file.read()
                 if f"def{function_name}(" not in content.replace(" ", ""):
-                    raise EntryPointFunctionError(message=f"{entry_points} can not be found. {_ENTRY_POINT_MSG}")
+                    msg = f"{entry_points} can not be found. {_ENTRY_POINT_MSG}"
+                    warnings.warn(UserWarning(msg), stacklevel=2)
 
     @staticmethod
     def __generate_root_paths(content: str) -> List[Tuple[str, str]]:
diff --git a/src/pytest_vulture/vulture/manager.py b/src/pytest_vulture/vulture/manager.py
index 1f67d22..ff7a643 100644
--- a/src/pytest_vulture/vulture/manager.py
+++ b/src/pytest_vulture/vulture/manager.py
@@ -35,9 +35,10 @@ def call(self) -> None:
         """Call vulture on a folder
         Example::
             >>> import py
+            >>> Path("/tmp/test-path").mkdir(exist_ok=True)  # add some code
             >>> config = IniReader(path_ini=Path("vulture.ini"), is_pyproject=False)
             >>> config.read_ini()
-            >>> manager = VultureManager(Path("/tmp"), config)
+            >>> manager = VultureManager(Path("/tmp/test-path"), config)
             >>> manager.call()
         """
         vulture_configuration = self._config.vulture_configuration
diff --git a/test/tests/functional/test_setup.py b/test/tests/functional/test_setup.py
index 19a609a..39c80e6 100644
--- a/test/tests/functional/test_setup.py
+++ b/test/tests/functional/test_setup.py
@@ -1,5 +1,6 @@
 """tests the setup parser system to find entry points."""
 
+import warnings
 from pathlib import Path
 from unittest.mock import Mock
 
@@ -7,8 +8,6 @@
 from vulture.core import Item
 
 from pytest_vulture.setup_manager import (
-    EntryPointFileError,
-    EntryPointFunctionError,
     SetupManager,
 )
 
@@ -68,18 +67,26 @@ def test_is_entry_point(
 
 
 @pytest.mark.parametrize(
-    ("path", "error"),
+    "path",
     [
-        ("setup_file_not_found", EntryPointFileError),
-        ("setup_entry_p_not_found", EntryPointFunctionError),
+        "setup_file_not_found",
+        "setup_entry_p_not_found",
     ],
 )
-def test_errors(examples_path, path, error):
+def test_errors(examples_path, path, monkeypatch):
+    warn = Mock()
+    monkeypatch.setattr(
+        warnings,
+        "warn",
+        warn,
+    )
     conf = Mock()
     conf.package_configuration.check_entry_points = True
     not_found_path = examples_path / "setups" / path
     conf.package_configuration.source_path = Path()
     conf.package_configuration.setup_path = not_found_path
+    assert warn.called is False
 
-    with pytest.raises(error):
-        SetupManager(conf)
+    SetupManager(conf)
+
+    assert warn.called is True