Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Add tests for pypa#104
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Jan 31, 2021
1 parent 192ef78 commit f8a36fc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __pycache__/
.tox
.pytest_cache
doc/_build/
*.egg-info/
3 changes: 3 additions & 0 deletions tests/samples/test-for-issue-104/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
11 changes: 11 additions & 0 deletions tests/samples/test-for-issue-104/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys
from setuptools import setup
from os import path, environ, listdir
import json

children = listdir(sys.path[0])
out = path.join(environ['PEP517_ISSUE104_OUTDIR'], 'out.json')
with open(out, 'w') as f:
json.dump(children, f)

setup()
14 changes: 14 additions & 0 deletions tests/test_call_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import toml
import zipfile
import sys
import json

from mock import Mock

Expand Down Expand Up @@ -151,3 +152,16 @@ def test_custom_python_executable(monkeypatch, tmpdir):
hooks.get_requires_for_build_wheel()
runner.assert_called_once()
assert runner.call_args[0][0][0] == 'some-python'


def test_issue_104():
hooks = get_hooks('test-for-issue-104')
with TemporaryDirectory() as outdir:
with modified_env({
'PYTHONPATH': BUILDSYS_PKGS,
'PEP517_ISSUE104_OUTDIR': outdir,
}):
hooks.get_requires_for_build_wheel({})
with open(pjoin(outdir, 'out.json')) as f:
children = json.load(f)
assert set(children) <= {'__init__.py', '_in_process.py', '__pycache__'}

0 comments on commit f8a36fc

Please sign in to comment.