Skip to content

Commit

Permalink
Add test for loading from wheel.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed May 12, 2023
1 parent 6e54534 commit 93de895
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 6 additions & 0 deletions jaraco/packaging/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def _load_metadata_from_wheel():
If indicated by an environment variable, expect the metadata
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])
Expand Down

0 comments on commit 93de895

Please sign in to comment.