diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..7602627 --- /dev/null +++ b/conftest.py @@ -0,0 +1,14 @@ +import subprocess + +import pytest + + +@pytest.fixture +def static_wheel(tmp_path, monkeypatch): + subprocess.check_call( + ['pip', 'download', '--no-deps', '--dest', str(tmp_path), 'sampleproject'], + stderr=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + ) + (wheel,) = tmp_path.iterdir() + monkeypatch.setenv('JARACO_PACKAGING_SPHINX_WHEEL', str(wheel)) diff --git a/jaraco/packaging/sphinx.py b/jaraco/packaging/sphinx.py index a9f62e6..b248e8e 100644 --- a/jaraco/packaging/sphinx.py +++ b/jaraco/packaging/sphinx.py @@ -36,6 +36,12 @@ def _load_metadata_from_wheel(): If indicated by an environment variable, expect the metadat to be present in a wheel and load it from there, avoiding the build process. Ref jaraco/jaraco.packaging#7. + + >>> _load_metadata_from_wheel() + >>> getfixture('static_wheel') + >>> meta = _load_metadata_from_wheel() + >>> meta['Name'] + 'sampleproject' """ wheel = os.environ['JARACO_PACKAGING_SPHINX_WHEEL'] (dist,) = metadata.distributions(path=[wheel])