Remove unsafe dependency check

Fixes #97
This commit is contained in:
Ethan Paul 2024-08-13 12:54:28 -04:00 committed by Ethan Paul
parent 0a46b2d876
commit 661072a69f
Signed by: enpaul
GPG Key ID: 4884CA087E5A472D
5 changed files with 0 additions and 33 deletions

View File

@ -227,7 +227,6 @@ error will be set to one of the "Status" values below to indicate what the error
| `LockedDepNotFoundError` | Indicates that an item specified in the `locked_deps` config option does not match the name of a package in the Poetry lockfile. | | `LockedDepNotFoundError` | Indicates that an item specified in the `locked_deps` config option does not match the name of a package in the Poetry lockfile. |
| `LockedDepsRequiredError` | Indicates that a test environment with the `require_locked_deps` config option set to `true` also specified unlocked dependencies using the [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) config option. | | `LockedDepsRequiredError` | Indicates that a test environment with the `require_locked_deps` config option set to `true` also specified unlocked dependencies using the [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) config option. |
| `PoetryNotInstalledError` | Indicates that the `poetry` module could not be imported under the current runtime environment, and `require_poetry = true` was specified. | | `PoetryNotInstalledError` | Indicates that the `poetry` module could not be imported under the current runtime environment, and `require_poetry = true` was specified. |
| `RequiresUnsafeDepError` | Indicates that the package-under-test depends on a package that Poetry has classified as unsafe and cannot be installed. |
> **Note:** One or more of these errors can be caused by the `pyproject.toml` being out > **Note:** One or more of these errors can be caused by the `pyproject.toml` being out
> of sync with the Poetry lockfile. If this is the case, than a warning will be logged > of sync with the Poetry lockfile. If this is the case, than a warning will be logged

View File

@ -11,17 +11,6 @@ from tox_poetry_installer import exceptions
from tox_poetry_installer import utilities from tox_poetry_installer import utilities
def test_exclude_unsafe():
"""Test that the unsafe packages are properly excluded
Also ensure that the internal constant matches the value from Poetry
"""
assert Provider.UNSAFE_PACKAGES == constants.UNSAFE_PACKAGES
for dep in constants.UNSAFE_PACKAGES:
assert not utilities.identify_transients(dep, {}, None)
def test_allow_missing(): def test_allow_missing():
"""Test that the ``allow_missing`` parameter works as expected""" """Test that the ``allow_missing`` parameter works as expected"""
with pytest.raises(exceptions.LockedDepNotFoundError): with pytest.raises(exceptions.LockedDepNotFoundError):

View File

@ -19,9 +19,5 @@ PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<")
# console output. # console output.
REPORTER_PREFIX: str = f"{__about__.__title__}:" REPORTER_PREFIX: str = f"{__about__.__title__}:"
# Internal list of packages that poetry has deemed unsafe and are excluded from the lockfile
# TODO: This functionality is no longer needed, should remove in a future update.
UNSAFE_PACKAGES: Set[str] = set()
# Number of threads to use for installing dependencies by default # Number of threads to use for installing dependencies by default
DEFAULT_INSTALL_THREADS: int = 10 DEFAULT_INSTALL_THREADS: int = 10

View File

@ -11,7 +11,6 @@ All exceptions should inherit from the common base exception :exc:`ToxPoetryInst
+-- LockedDepNotFoundError +-- LockedDepNotFoundError
+-- ExtraNotFoundError +-- ExtraNotFoundError
+-- LockedDepsRequiredError +-- LockedDepsRequiredError
+-- RequiresUnsafeDepError
""" """
@ -42,7 +41,3 @@ class ExtraNotFoundError(ToxPoetryInstallerException):
class LockedDepsRequiredError(ToxPoetryInstallerException): class LockedDepsRequiredError(ToxPoetryInstallerException):
"""Environment cannot specify unlocked dependencies when locked dependencies are required""" """Environment cannot specify unlocked dependencies when locked dependencies are required"""
class RequiresUnsafeDepError(ToxPoetryInstallerException):
"""Package under test depends on an unsafe dependency and cannot be installed"""

View File

@ -132,13 +132,6 @@ def identify_transients(
except KeyError as err: except KeyError as err:
missing = err.args[0] missing = err.args[0]
if missing in constants.UNSAFE_PACKAGES:
logger.warning(
f"Installing package '{missing}' using Poetry is not supported and will be skipped"
)
logger.debug(f"Skipping {missing}: designated unsafe by Poetry")
return []
if missing in allow_missing: if missing in allow_missing:
logger.debug(f"Skipping {missing}: package is allowed to be unlocked") logger.debug(f"Skipping {missing}: package is allowed to be unlocked")
return [] return []
@ -171,11 +164,6 @@ def find_project_deps(
:param extras: Sequence of extra names to include the dependencies of :param extras: Sequence of extra names to include the dependencies of
""" """
if any(dep.name in constants.UNSAFE_PACKAGES for dep in poetry.package.requires):
raise exceptions.RequiresUnsafeDepError(
f"Project package requires one or more unsafe dependencies ({', '.join(constants.UNSAFE_PACKAGES)}) which cannot be installed with Poetry"
)
required_dep_names = [ required_dep_names = [
item.name for item in poetry.package.requires if not item.is_optional() item.name for item in poetry.package.requires if not item.is_optional()
] ]