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

Use typeguard in tests #171

Merged
merged 1 commit into from
Jan 16, 2024
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ To make a new release, do this:
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)

* [**dev**](https://github.com/jedie/PyInventory/compare/v0.19.3...main)
* 2024-01-16 - Use typeguard in tests
* 2024-01-16 - Update requirements
* [v0.19.3](https://github.com/jedie/PyInventory/compare/v0.19.2...v0.19.3)
* 2023-11-01 - Auto generate README history
Expand Down
10 changes: 10 additions & 0 deletions inventory_project/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@
Allow your-cool-package to be executable
through `python -m inventory`.
"""

import sys

from manage_django_project.manage import execute_django_from_command_line
from typeguard import install_import_hook


def main():
"""
entrypoint installed via pyproject.toml and [project.scripts] section.
Must be set in ./manage.py and PROJECT_SHELL_SCRIPT
"""

if 'test' in sys.argv:
# Install typeguard import hook to check for missing type annotations.
# Sadly we can't add this into: cli_base/tests/__init__.py
install_import_hook(packages=('inventory', 'inventory_project'))

execute_django_from_command_line()


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dev = [
"safety", # https://github.com/pyupio/safety
"mypy", # https://github.com/python/mypy
"twine", # https://github.com/pypa/twine
"typeguard", # https://github.com/agronholm/typeguard/

# https://github.com/akaihola/darker
# https://github.com/ikamensh/flynt
Expand Down
5 changes: 5 additions & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,10 @@ twine==4.0.2 \
--hash=sha256:929bc3c280033347a00f847236564d1c52a3e61b1ac2516c97c48f3ceab756d8 \
--hash=sha256:9e102ef5fdd5a20661eb88fad46338806c3bd32cf1db729603fe3697b1bc83c8
# via PyInventory (pyproject.toml)
typeguard==4.1.5 \
--hash=sha256:8923e55f8873caec136c892c3bed1f676eae7be57cdb94819281b3d3bc9c0953 \
--hash=sha256:ea0a113bbc111bcffc90789ebb215625c963411f7096a7e9062d4e4630c155fd
# via PyInventory (pyproject.toml)
types-python-dateutil==2.8.19.20240106 \
--hash=sha256:1f8db221c3b98e6ca02ea83a58371b22c374f42ae5bbdf186db9c9a76581459f \
--hash=sha256:efbbdc54590d0f16152fa103c9879c7d4a00e82078f6e2cf01769042165acaa2
Expand All @@ -1425,6 +1429,7 @@ typing-extensions==4.9.0 \
# mypy
# pyee
# rich-click
# typeguard
urllib3==2.1.0 \
--hash=sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3 \
--hash=sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54
Expand Down