Skip to content

Commit 6df0fd9

Browse files
committed
Install test plugin package from wheel rather than source
1 parent a76b6e8 commit 6df0fd9

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

tests/artifacts/test-plugin-package/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ build-backend = "flit_core.buildapi"
66
name = "test-plugin-package"
77
version = "0"
88
description = "Installable plugin for testing"
9+
requires-python = ">=3.9"
Binary file not shown.

tests/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ def mocked_entry_points(
4040
MockedEntryPoint("second", "tests.mocked_plugins:MockedPluginB"),
4141
MockedEntryPoint("third", "tests.mocked_plugins:MockedPluginC"),
4242
]
43+
44+
45+
@pytest.fixture(scope="session")
46+
def test_plugin_package_req() -> str:
47+
installable_package = (
48+
Path("tests/artifacts/test_plugin_package-0-py3-none-any.whl")
49+
.absolute()
50+
.as_posix()
51+
)
52+
return f"test-plugin-package @ file://{installable_package}"

tests/plugins/test_loader.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from abc import ABC
77
from abc import abstractproperty
88
from email import message_from_string
9-
from pathlib import Path
109
from typing import Any
1110

1211
import pytest
@@ -445,16 +444,13 @@ def test_load_plugins_from_entry_points(mocked_entry_points: None) -> None:
445444
}
446445

447446

448-
def test_install_plugin():
449-
installable_package = (
450-
Path("tests/artifacts/test-plugin-package").absolute().as_posix()
451-
)
447+
def test_install_plugin(test_plugin_package_req: str):
452448
metadata = VariantMetadata(
453449
namespace_priorities=["installable_plugin"],
454450
providers={
455451
"installable_plugin": ProviderInfo(
456452
plugin_api="test_plugin_package:TestPlugin",
457-
requires=[f"test-plugin-package @ file://{installable_package}"],
453+
requires=[test_plugin_package_req],
458454
),
459455
},
460456
)

tests/plugins/test_py_envs.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,14 @@
1111
from variantlib.plugins.py_envs import python_env
1212

1313

14-
@pytest.fixture(scope="session")
15-
def test_package_req() -> str:
16-
installable_package = (
17-
Path("tests/artifacts/test-plugin-package").absolute().as_posix()
18-
)
19-
return f"test-plugin-package @ file://{installable_package}"
20-
21-
2214
def test_system_env():
2315
with python_env(isolated=False) as env:
2416
assert env.venv_path is None
2517
assert env.python_executable == Path(sys.executable)
2618

2719

2820
@pytest.mark.parametrize("custom", [False, True])
29-
def test_isolated_env(custom: bool, tmp_path: Path, test_package_req: str):
21+
def test_isolated_env(custom: bool, tmp_path: Path, test_plugin_package_req: str):
3022
if custom:
3123
venv.create(tmp_path, with_pip=True)
3224
with python_env(isolated=True, venv_path=tmp_path if custom else None) as env:
@@ -40,7 +32,7 @@ def test_isolated_env(custom: bool, tmp_path: Path, test_package_req: str):
4032
"python.exe" if os.name == "nt" else "python"
4133
)
4234

43-
env.install([test_package_req])
35+
env.install([test_plugin_package_req])
4436

4537
purelib = Path(sysconfig.get_path("purelib", vars={"base": str(env.venv_path)}))
4638
assert (purelib / "test_plugin_package.py").exists()

0 commit comments

Comments
 (0)