Skip to content

Commit

Permalink
Merge pull request #171 from jedie/typeguard
Browse files Browse the repository at this point in the history
Use typeguard in tests
  • Loading branch information
jedie authored Jan 16, 2024
2 parents 1b513ca + 1b109c4 commit ff210a0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
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

0 comments on commit ff210a0

Please sign in to comment.