django-pre-commit-hooks 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+
2
+ MIT License
3
+
4
+ Copyright (c) 2025 Bruno Alla
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-pre-commit-hooks
3
+ Version: 0.1.0
4
+ Summary: A collection of pre-commit hooks for Django projects
5
+ Author-email: Bruno Alla <oss@browniebroke.com>
6
+ License: MIT
7
+ Project-URL: Bug Tracker, https://github.com/browniebroke/django-pre-commit-hooks/issues
8
+ Project-URL: Changelog, https://github.com/browniebroke/django-pre-commit-hooks/blob/main/CHANGELOG.md
9
+ Project-URL: repository, https://github.com/browniebroke/django-pre-commit-hooks
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: django
24
+ Dynamic: license-file
25
+
26
+ # Django pre-commit hooks
27
+
28
+ <p align="center">
29
+ <a href="https://github.com/browniebroke/django-pre-commit-hooks/actions/workflows/ci.yml?query=branch%3Amain">
30
+ <img src="https://img.shields.io/github/actions/workflow/status/browniebroke/django-pre-commit-hooks/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
31
+ </a>
32
+ <a href="https://codecov.io/gh/browniebroke/django-pre-commit-hooks">
33
+ <img src="https://img.shields.io/codecov/c/github/browniebroke/django-pre-commit-hooks.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
34
+ </a>
35
+ </p>
36
+ <p align="center">
37
+ <a href="https://github.com/astral-sh/uv">
38
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv">
39
+ </a>
40
+ <a href="https://github.com/astral-sh/ruff">
41
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
42
+ </a>
43
+ <a href="https://github.com/pre-commit/pre-commit">
44
+ <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
45
+ </a>
46
+ </p>
47
+ <p align="center">
48
+ <a href="https://pypi.org/project/django-pre-commit-hooks/">
49
+ <img src="https://img.shields.io/pypi/v/django-pre-commit-hooks.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
50
+ </a>
51
+ <img src="https://img.shields.io/pypi/pyversions/django-pre-commit-hooks.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
52
+ <img src="https://img.shields.io/pypi/l/django-pre-commit-hooks.svg?style=flat-square" alt="License">
53
+ </p>
54
+
55
+ ---
56
+
57
+ **Source Code**: <a href="https://github.com/browniebroke/django-pre-commit-hooks" target="_blank">https://github.com/browniebroke/django-pre-commit-hooks </a>
58
+
59
+ ---
60
+
61
+ A collection of pre-commit hooks for Django projects
62
+
63
+ ## Installation
64
+
65
+ Install this via pip (or your favourite package manager):
66
+
67
+ `pip install django-pre-commit-hooks`
68
+
69
+ ## Usage
70
+
71
+ Call the command line interface:
72
+
73
+ ```bash
74
+ django-pre-commit-hooks --help
75
+ ```
76
+
77
+ ## Contributors ✨
78
+
79
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
80
+
81
+ <!-- prettier-ignore-start -->
82
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
83
+ <!-- prettier-ignore-start -->
84
+ <!-- markdownlint-disable -->
85
+ <table>
86
+ <tbody>
87
+ <tr>
88
+ <td align="center" valign="top" width="14.28%"><a href="https://browniebroke.com/"><img src="https://avatars.githubusercontent.com/u/861044?v=4?s=80" width="80px;" alt="Bruno Alla"/><br /><sub><b>Bruno Alla</b></sub></a><br /><a href="https://github.com/browniebroke/django-pre-commit-hooks/commits?author=browniebroke" title="Code">💻</a> <a href="#ideas-browniebroke" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/browniebroke/django-pre-commit-hooks/commits?author=browniebroke" title="Documentation">📖</a></td>
89
+ </tr>
90
+ </tbody>
91
+ </table>
92
+
93
+ <!-- markdownlint-restore -->
94
+ <!-- prettier-ignore-end -->
95
+
96
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
97
+ <!-- prettier-ignore-end -->
98
+
99
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
100
+
101
+ ## Credits
102
+
103
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-orange.json)](https://github.com/copier-org/copier)
104
+
105
+ This package was created with
106
+ [Copier](https://copier.readthedocs.io/) and the
107
+ [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
108
+ project template.
@@ -0,0 +1,83 @@
1
+ # Django pre-commit hooks
2
+
3
+ <p align="center">
4
+ <a href="https://github.com/browniebroke/django-pre-commit-hooks/actions/workflows/ci.yml?query=branch%3Amain">
5
+ <img src="https://img.shields.io/github/actions/workflow/status/browniebroke/django-pre-commit-hooks/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
6
+ </a>
7
+ <a href="https://codecov.io/gh/browniebroke/django-pre-commit-hooks">
8
+ <img src="https://img.shields.io/codecov/c/github/browniebroke/django-pre-commit-hooks.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
9
+ </a>
10
+ </p>
11
+ <p align="center">
12
+ <a href="https://github.com/astral-sh/uv">
13
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv">
14
+ </a>
15
+ <a href="https://github.com/astral-sh/ruff">
16
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
17
+ </a>
18
+ <a href="https://github.com/pre-commit/pre-commit">
19
+ <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
20
+ </a>
21
+ </p>
22
+ <p align="center">
23
+ <a href="https://pypi.org/project/django-pre-commit-hooks/">
24
+ <img src="https://img.shields.io/pypi/v/django-pre-commit-hooks.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
25
+ </a>
26
+ <img src="https://img.shields.io/pypi/pyversions/django-pre-commit-hooks.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
27
+ <img src="https://img.shields.io/pypi/l/django-pre-commit-hooks.svg?style=flat-square" alt="License">
28
+ </p>
29
+
30
+ ---
31
+
32
+ **Source Code**: <a href="https://github.com/browniebroke/django-pre-commit-hooks" target="_blank">https://github.com/browniebroke/django-pre-commit-hooks </a>
33
+
34
+ ---
35
+
36
+ A collection of pre-commit hooks for Django projects
37
+
38
+ ## Installation
39
+
40
+ Install this via pip (or your favourite package manager):
41
+
42
+ `pip install django-pre-commit-hooks`
43
+
44
+ ## Usage
45
+
46
+ Call the command line interface:
47
+
48
+ ```bash
49
+ django-pre-commit-hooks --help
50
+ ```
51
+
52
+ ## Contributors ✨
53
+
54
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
55
+
56
+ <!-- prettier-ignore-start -->
57
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
58
+ <!-- prettier-ignore-start -->
59
+ <!-- markdownlint-disable -->
60
+ <table>
61
+ <tbody>
62
+ <tr>
63
+ <td align="center" valign="top" width="14.28%"><a href="https://browniebroke.com/"><img src="https://avatars.githubusercontent.com/u/861044?v=4?s=80" width="80px;" alt="Bruno Alla"/><br /><sub><b>Bruno Alla</b></sub></a><br /><a href="https://github.com/browniebroke/django-pre-commit-hooks/commits?author=browniebroke" title="Code">💻</a> <a href="#ideas-browniebroke" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/browniebroke/django-pre-commit-hooks/commits?author=browniebroke" title="Documentation">📖</a></td>
64
+ </tr>
65
+ </tbody>
66
+ </table>
67
+
68
+ <!-- markdownlint-restore -->
69
+ <!-- prettier-ignore-end -->
70
+
71
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
72
+ <!-- prettier-ignore-end -->
73
+
74
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
75
+
76
+ ## Credits
77
+
78
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-orange.json)](https://github.com/copier-org/copier)
79
+
80
+ This package was created with
81
+ [Copier](https://copier.readthedocs.io/) and the
82
+ [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
83
+ project template.
@@ -0,0 +1,156 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [ "setuptools" ]
4
+
5
+ [project]
6
+ name = "django-pre-commit-hooks"
7
+ version = "0.1.0"
8
+ description = "A collection of pre-commit hooks for Django projects"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [
12
+ { name = "Bruno Alla", email = "oss@browniebroke.com" },
13
+ ]
14
+ requires-python = ">=3.9"
15
+ classifiers = [
16
+ "Development Status :: 2 - Pre-Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Natural Language :: English",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development :: Libraries",
26
+ ]
27
+
28
+ dependencies = [
29
+ "django",
30
+ ]
31
+ urls."Bug Tracker" = "https://github.com/browniebroke/django-pre-commit-hooks/issues"
32
+ urls.Changelog = "https://github.com/browniebroke/django-pre-commit-hooks/blob/main/CHANGELOG.md"
33
+ urls.repository = "https://github.com/browniebroke/django-pre-commit-hooks"
34
+ scripts.compile-messages = "django_pre_commit_hooks.compile_messages:main"
35
+
36
+ [dependency-groups]
37
+ dev = [
38
+ "coverage",
39
+ "pytest>=8,<9",
40
+ "pytest-cov>=6,<7",
41
+ "pytest-mock>=3.14.1",
42
+ ]
43
+
44
+ [tool.ruff]
45
+ line-length = 88
46
+ lint.select = [
47
+ "B", # flake8-bugbear
48
+ "D", # flake8-docstrings
49
+ "C4", # flake8-comprehensions
50
+ "S", # flake8-bandit
51
+ "F", # pyflake
52
+ "E", # pycodestyle
53
+ "W", # pycodestyle
54
+ "UP", # pyupgrade
55
+ "I", # isort
56
+ "RUF", # ruff specific
57
+ ]
58
+ lint.ignore = [
59
+ "D203", # 1 blank line required before class docstring
60
+ "D212", # Multi-line docstring summary should start at the first line
61
+ "D100", # Missing docstring in public module
62
+ "D104", # Missing docstring in public package
63
+ "D107", # Missing docstring in `__init__`
64
+ "D401", # First line of docstring should be in imperative mood
65
+ ]
66
+ lint.per-file-ignores."conftest.py" = [ "D100" ]
67
+ lint.per-file-ignores."setup.py" = [ "D100" ]
68
+ lint.per-file-ignores."tests/**/*" = [
69
+ "D100",
70
+ "D101",
71
+ "D102",
72
+ "D103",
73
+ "D104",
74
+ "S101",
75
+ ]
76
+ lint.isort.known-first-party = [ "django_pre_commit_hooks", "tests" ]
77
+
78
+ [tool.pytest.ini_options]
79
+ addopts = """\
80
+ -v
81
+ -Wdefault
82
+ --cov=django_pre_commit_hooks
83
+ --cov-report=term
84
+ --cov-report=xml
85
+ """
86
+ pythonpath = [ "src" ]
87
+
88
+ [tool.coverage.run]
89
+ branch = true
90
+
91
+ [tool.coverage.paths]
92
+ source = [
93
+ "src",
94
+ ".tox/**/site-packages",
95
+ ]
96
+
97
+ [tool.coverage.report]
98
+ exclude_lines = [
99
+ "pragma: no cover",
100
+ "@overload",
101
+ "if TYPE_CHECKING",
102
+ "raise NotImplementedError",
103
+ 'if __name__ == "__main__":',
104
+ ]
105
+
106
+ [tool.mypy]
107
+ check_untyped_defs = true
108
+ disallow_any_generics = true
109
+ disallow_incomplete_defs = true
110
+ disallow_untyped_defs = true
111
+ mypy_path = "src/"
112
+ no_implicit_optional = true
113
+ show_error_codes = true
114
+ warn_unreachable = true
115
+ warn_unused_ignores = true
116
+ exclude = [
117
+ 'setup.py',
118
+ ]
119
+
120
+ [[tool.mypy.overrides]]
121
+ module = "tests.*"
122
+ allow_untyped_defs = true
123
+
124
+ [tool.semantic_release]
125
+ version_toml = [ "pyproject.toml:project.version" ]
126
+ version_variables = [
127
+ "src/django_pre_commit_hooks/__init__.py:__version__",
128
+ ]
129
+ build_command = """
130
+ pip install uv
131
+ uv lock
132
+ git add uv.lock
133
+ uv build
134
+ """
135
+
136
+ [tool.semantic_release.changelog]
137
+ exclude_commit_patterns = [
138
+ '''chore(?:\([^)]*?\))?: .+''',
139
+ '''ci(?:\([^)]*?\))?: .+''',
140
+ '''refactor(?:\([^)]*?\))?: .+''',
141
+ '''style(?:\([^)]*?\))?: .+''',
142
+ '''test(?:\([^)]*?\))?: .+''',
143
+ '''build\((?!deps\): .+)''',
144
+ '''Merged? .*''',
145
+ '''Initial [Cc]ommit.*''', # codespell:ignore
146
+ ]
147
+
148
+ [tool.semantic_release.changelog.environment]
149
+ keep_trailing_newline = true
150
+
151
+ [tool.semantic_release.branches.main]
152
+ match = "main"
153
+
154
+ [tool.semantic_release.branches.noop]
155
+ match = "(?!main$)"
156
+ prerelease = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,37 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from collections.abc import Sequence
5
+ from pathlib import Path
6
+
7
+ from django.core.management import execute_from_command_line
8
+
9
+
10
+ def main(argv: Sequence[str] | None = None) -> int:
11
+ """Run django-admin compilemessages for each .po file."""
12
+ parser = argparse.ArgumentParser()
13
+ parser.add_argument("filenames", nargs="*")
14
+ args = parser.parse_args(argv)
15
+
16
+ retval = 0
17
+ for filename in args.filenames:
18
+ path = Path(filename)
19
+ # Assume the path is <locale>/LC_MESSAGES/django.po
20
+ locale = path.parent.parent
21
+ execute_from_command_line(
22
+ [
23
+ "django-admin",
24
+ "compilemessages",
25
+ "--locale",
26
+ locale.name,
27
+ "--ignore",
28
+ ".venv",
29
+ "--ignore",
30
+ ".tox",
31
+ ]
32
+ )
33
+ return retval
34
+
35
+
36
+ if __name__ == "__main__":
37
+ raise SystemExit(main())
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-pre-commit-hooks
3
+ Version: 0.1.0
4
+ Summary: A collection of pre-commit hooks for Django projects
5
+ Author-email: Bruno Alla <oss@browniebroke.com>
6
+ License: MIT
7
+ Project-URL: Bug Tracker, https://github.com/browniebroke/django-pre-commit-hooks/issues
8
+ Project-URL: Changelog, https://github.com/browniebroke/django-pre-commit-hooks/blob/main/CHANGELOG.md
9
+ Project-URL: repository, https://github.com/browniebroke/django-pre-commit-hooks
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: django
24
+ Dynamic: license-file
25
+
26
+ # Django pre-commit hooks
27
+
28
+ <p align="center">
29
+ <a href="https://github.com/browniebroke/django-pre-commit-hooks/actions/workflows/ci.yml?query=branch%3Amain">
30
+ <img src="https://img.shields.io/github/actions/workflow/status/browniebroke/django-pre-commit-hooks/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
31
+ </a>
32
+ <a href="https://codecov.io/gh/browniebroke/django-pre-commit-hooks">
33
+ <img src="https://img.shields.io/codecov/c/github/browniebroke/django-pre-commit-hooks.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
34
+ </a>
35
+ </p>
36
+ <p align="center">
37
+ <a href="https://github.com/astral-sh/uv">
38
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv">
39
+ </a>
40
+ <a href="https://github.com/astral-sh/ruff">
41
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
42
+ </a>
43
+ <a href="https://github.com/pre-commit/pre-commit">
44
+ <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
45
+ </a>
46
+ </p>
47
+ <p align="center">
48
+ <a href="https://pypi.org/project/django-pre-commit-hooks/">
49
+ <img src="https://img.shields.io/pypi/v/django-pre-commit-hooks.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
50
+ </a>
51
+ <img src="https://img.shields.io/pypi/pyversions/django-pre-commit-hooks.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
52
+ <img src="https://img.shields.io/pypi/l/django-pre-commit-hooks.svg?style=flat-square" alt="License">
53
+ </p>
54
+
55
+ ---
56
+
57
+ **Source Code**: <a href="https://github.com/browniebroke/django-pre-commit-hooks" target="_blank">https://github.com/browniebroke/django-pre-commit-hooks </a>
58
+
59
+ ---
60
+
61
+ A collection of pre-commit hooks for Django projects
62
+
63
+ ## Installation
64
+
65
+ Install this via pip (or your favourite package manager):
66
+
67
+ `pip install django-pre-commit-hooks`
68
+
69
+ ## Usage
70
+
71
+ Call the command line interface:
72
+
73
+ ```bash
74
+ django-pre-commit-hooks --help
75
+ ```
76
+
77
+ ## Contributors ✨
78
+
79
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
80
+
81
+ <!-- prettier-ignore-start -->
82
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
83
+ <!-- prettier-ignore-start -->
84
+ <!-- markdownlint-disable -->
85
+ <table>
86
+ <tbody>
87
+ <tr>
88
+ <td align="center" valign="top" width="14.28%"><a href="https://browniebroke.com/"><img src="https://avatars.githubusercontent.com/u/861044?v=4?s=80" width="80px;" alt="Bruno Alla"/><br /><sub><b>Bruno Alla</b></sub></a><br /><a href="https://github.com/browniebroke/django-pre-commit-hooks/commits?author=browniebroke" title="Code">💻</a> <a href="#ideas-browniebroke" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/browniebroke/django-pre-commit-hooks/commits?author=browniebroke" title="Documentation">📖</a></td>
89
+ </tr>
90
+ </tbody>
91
+ </table>
92
+
93
+ <!-- markdownlint-restore -->
94
+ <!-- prettier-ignore-end -->
95
+
96
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
97
+ <!-- prettier-ignore-end -->
98
+
99
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
100
+
101
+ ## Credits
102
+
103
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-orange.json)](https://github.com/copier-org/copier)
104
+
105
+ This package was created with
106
+ [Copier](https://copier.readthedocs.io/) and the
107
+ [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
108
+ project template.
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/django_pre_commit_hooks/__init__.py
5
+ src/django_pre_commit_hooks/compile_messages.py
6
+ src/django_pre_commit_hooks/py.typed
7
+ src/django_pre_commit_hooks.egg-info/PKG-INFO
8
+ src/django_pre_commit_hooks.egg-info/SOURCES.txt
9
+ src/django_pre_commit_hooks.egg-info/dependency_links.txt
10
+ src/django_pre_commit_hooks.egg-info/entry_points.txt
11
+ src/django_pre_commit_hooks.egg-info/requires.txt
12
+ src/django_pre_commit_hooks.egg-info/top_level.txt
13
+ tests/test_compile_messages.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ compile-messages = django_pre_commit_hooks.compile_messages:main
@@ -0,0 +1,58 @@
1
+ from __future__ import annotations
2
+
3
+ from unittest.mock import MagicMock
4
+
5
+ import pytest
6
+ from pytest_mock import MockerFixture
7
+
8
+ from django_pre_commit_hooks.compile_messages import main
9
+
10
+ from .utils import get_resource_path
11
+
12
+
13
+ @pytest.fixture
14
+ def execute_from_command_line(mocker: MockerFixture) -> MagicMock:
15
+ return mocker.patch(
16
+ "django_pre_commit_hooks.compile_messages.execute_from_command_line"
17
+ )
18
+
19
+
20
+ def test_no_files(execute_from_command_line):
21
+ ret = main([])
22
+ assert ret == 0
23
+ execute_from_command_line.assert_not_called()
24
+
25
+
26
+ def test_failing_file(execute_from_command_line):
27
+ execute_from_command_line.side_effect = SystemExit(1)
28
+ with pytest.raises(SystemExit):
29
+ main([get_resource_path("locales/fr_CA/LC_MESSAGES/test.po")])
30
+ execute_from_command_line.assert_called_once_with(
31
+ [
32
+ "django-admin",
33
+ "compilemessages",
34
+ "--locale",
35
+ "fr_CA",
36
+ "--ignore",
37
+ ".venv",
38
+ "--ignore",
39
+ ".tox",
40
+ ],
41
+ )
42
+
43
+
44
+ def test_passing_file(execute_from_command_line):
45
+ ret = main([get_resource_path("locales/fr_FR/LC_MESSAGES/test.po")])
46
+ assert ret == 0
47
+ execute_from_command_line.assert_called_once_with(
48
+ [
49
+ "django-admin",
50
+ "compilemessages",
51
+ "--locale",
52
+ "fr_FR",
53
+ "--ignore",
54
+ ".venv",
55
+ "--ignore",
56
+ ".tox",
57
+ ],
58
+ )