-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters