Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- F include py.typed #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added approval_utilities/py.typed
Empty file.
Empty file added approvaltests/py.typed
Empty file.
4 changes: 3 additions & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-r requirements.prod.txt
-r requirements.test.txt
black
black
setuptools
mypy
2 changes: 1 addition & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python -m pip install --upgrade pip
pip install tox
pip install pytest
tox -e py
tox -e py && tox -e test__py_typed_files_exist
59 changes: 59 additions & 0 deletions test__py_typed_files_exist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import pathlib
import tempfile
import subprocess
import sys
import time
import typing

from version import version_number


def main() -> None:
for package_name, setup_file in [
("approval_utilities", "setup.approval_utilities.py"),
("approvaltests", "setup.py"),
]:
build_number = str(int(time.time()))
_run_python_checked(
[
setup_file,
"bdist_wheel",
"--build-number",
build_number,
]
)
_run_python_checked(
[
"-m",
"pip",
"install",
"--force-reinstall",
# version_number starts with `v`; remove that character
f"dist/{package_name}-{version_number[1:]}-{build_number}-py3-none-any.whl",
]
)

with tempfile.NamedTemporaryFile(suffix=".py") as _test_file:
test_file = pathlib.Path(_test_file.name)
test_file.write_text(
f"import {package_name}"
)

_run_python_checked(
["-m", "mypy", test_file.name],
cwd=test_file.parent,
)


def _run_python_checked(
args: typing.List[str], cwd: typing.Optional[pathlib.Path] = None
) -> None:
subprocess.run(
[sys.executable, *args],
check=True,
cwd=cwd,
)


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ commands =
; automatically install hook at .git/hooks
;{envdir}/bin/pre-commit install

[testenv:test__py_typed_files_exist]
deps = -rrequirements.txt
commands =
python test__py_typed_files_exist.py
Loading