Skip to content

Commit f301d59

Browse files
committed
- F include py.typed
1 parent 67ecfdc commit f301d59

File tree

6 files changed

+67
-2
lines changed

6 files changed

+67
-2
lines changed

approval_utilities/py.typed

Whitespace-only changes.

approvaltests/py.typed

Whitespace-only changes.

requirements.dev.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
-r requirements.prod.txt
22
-r requirements.test.txt
3-
black
3+
black
4+
setuptools
5+
mypy

run_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
python -m pip install --upgrade pip
22
pip install tox
33
pip install pytest
4-
tox -e py
4+
tox -e py && tox -e test__py_typed_files_exist

test__py_typed_files_exist.py

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import pathlib
2+
import tempfile
3+
import subprocess
4+
import sys
5+
import time
6+
import typing
7+
8+
from version import version_number
9+
10+
11+
def main() -> None:
12+
for package_name, setup_file in [
13+
("approval_utilities", "setup.approval_utilities.py"),
14+
("approvaltests", "setup.py"),
15+
]:
16+
build_number = str(int(time.time()))
17+
_run_python_checked(
18+
[
19+
setup_file,
20+
"bdist_wheel",
21+
"--build-number",
22+
build_number,
23+
]
24+
)
25+
_run_python_checked(
26+
[
27+
"-m",
28+
"pip",
29+
"install",
30+
"--force-reinstall",
31+
# version_number starts with `v`; remove that character
32+
f"dist/{package_name}-{version_number[1:]}-{build_number}-py3-none-any.whl",
33+
]
34+
)
35+
36+
with tempfile.NamedTemporaryFile(suffix=".py") as _test_file:
37+
test_file = pathlib.Path(_test_file.name)
38+
test_file.write_text(
39+
f"import {package_name}"
40+
)
41+
42+
_run_python_checked(
43+
["-m", "mypy", test_file.name],
44+
cwd=test_file.parent,
45+
)
46+
47+
48+
def _run_python_checked(
49+
args: typing.List[str], cwd: typing.Optional[pathlib.Path] = None
50+
) -> None:
51+
subprocess.run(
52+
[sys.executable, *args],
53+
check=True,
54+
cwd=cwd,
55+
)
56+
57+
58+
if __name__ == "__main__":
59+
main()

tox.ini

+4
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ commands =
2525
; automatically install hook at .git/hooks
2626
;{envdir}/bin/pre-commit install
2727

28+
[testenv:test__py_typed_files_exist]
29+
deps = -rrequirements.txt
30+
commands =
31+
python test__py_typed_files_exist.py

0 commit comments

Comments
 (0)