diff --git a/docs/source/plugins.rst b/docs/source/plugins.rst index 713fbc2..44ff464 100644 --- a/docs/source/plugins.rst +++ b/docs/source/plugins.rst @@ -47,3 +47,10 @@ Hooks "package" in place. :param package: An instanciate PackageMaker. + +.. py:function:: cleanup(dist: importlib.metadata.Distribution, path: str) -> None + + Cleanup a package post-installation. + + :param dist: Python distribution. + :param path: Root path of the rez variant. diff --git a/pytest.ini b/pytest.ini index d9f1853..aa02126 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,7 +7,7 @@ addopts = --cov-report=term-missing --cov-report=xml --cov-report=html - --durations=0 + #--durations=0 norecursedirs = rez_repo diff --git a/src/rez_pip/plugins/__init__.py b/src/rez_pip/plugins/__init__.py index 00beecb..d2bb53b 100644 --- a/src/rez_pip/plugins/__init__.py +++ b/src/rez_pip/plugins/__init__.py @@ -88,7 +88,8 @@ def getManager() -> pluggy.PluginManager: # Register the builtin plugins for module in pkgutil.iter_modules(__path__): manager.register( - importlib.import_module(f"rez_pip.plugins.{module.name}"), name=module.name + importlib.import_module(f"rez_pip.plugins.{module.name}"), + name=f"rez_pip.{module.name}", ) manager.load_setuptools_entrypoints("rez-pip") diff --git a/tests/test_cli.py b/tests/test_cli.py index ce827fe..b006f15 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -25,6 +25,7 @@ def test_parseArgs_empty(): assert vars(args) == { "constraint": None, "keep_tmp_dirs": False, + "list_plugins": False, "log_level": "info", "packages": [], "pip": rez_pip.pip.getBundledPip(), @@ -44,6 +45,7 @@ def test_parseArgs_packages(packages): assert vars(args) == { "constraint": None, "keep_tmp_dirs": False, + "list_plugins": False, "log_level": "info", "packages": packages, "pip": rez_pip.pip.getBundledPip(), @@ -63,6 +65,7 @@ def test_parseArgs_no_package_with_requirements(files): assert vars(args) == { "constraint": None, "keep_tmp_dirs": False, + "list_plugins": False, "log_level": "info", "packages": [], "pip": rez_pip.pip.getBundledPip(), @@ -81,6 +84,7 @@ def test_parseArgs_constraints(): assert vars(args) == { "constraint": ["asd", "adasdasd"], "keep_tmp_dirs": False, + "list_plugins": False, "log_level": "info", "packages": [], "pip": rez_pip.pip.getBundledPip(), @@ -101,6 +105,7 @@ def test_parseArgs_pipArgs(): assert vars(args) == { "constraint": None, "keep_tmp_dirs": False, + "list_plugins": False, "log_level": "info", "packages": [], "pip": rez_pip.pip.getBundledPip(), diff --git a/tests/test_rez.py b/tests/test_rez.py index d24bc97..db0dcb0 100644 --- a/tests/test_rez.py +++ b/tests/test_rez.py @@ -17,6 +17,7 @@ else: import importlib_metadata +import rez_pip.pip import rez_pip.rez import rez_pip.utils @@ -62,16 +63,28 @@ def make_file(path: str) -> importlib_metadata.PackagePath: metadata={"is_pure_python": False}, ) + packageGroup = rez_pip.pip.PackageGroup( + [ + rez_pip.pip.PackageInfo( + metadata=rez_pip.pip.Metadata(name="package-a", version="1.0.0.post0"), + download_info=rez_pip.pip.DownloadInfo( + url=f"http://localhost/asd", + archive_info=rez_pip.pip.ArchiveInfo("hash", {}), + ), + is_direct=True, + requested=True, + ) + ] + ) + packageGroup.dists = [dist] + with unittest.mock.patch.object( rez_pip.utils, "getRezRequirements", return_value=expectedRequirements ): rez_pip.rez.createPackage( - dist, - False, + packageGroup, rez.version.Version("3.7.0"), - [], source, - "http://localhost/asd", prefix=repo, ) @@ -84,7 +97,7 @@ def make_file(path: str) -> importlib_metadata.PackagePath: "name": dist.name, "version": dist.version, "is_pure_python": False, - "wheel_url": "http://localhost/asd", + "wheel_urls": ["http://localhost/asd"], "rez_pip_version": importlib_metadata.version("rez-pip"), "metadata": {}, }