Skip to content

Commit 3285b4f

Browse files
authored
Merge branch 'main' into uv
2 parents 0698a6c + 5eb1a72 commit 3285b4f

File tree

8 files changed

+41
-41
lines changed

8 files changed

+41
-41
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@ jobs:
341341
run: |
342342
just test ./tests/verify_environment.py
343343
just test-bash || exit 1
344+
sudo apt-get remove --purge -y powershell
345+
source .venv/bin/activate
346+
pytest --cov-append ./tests/shellcompletion/test_shell_resolution.py::test_get_win_shell_failure || exit 1
344347
345348
- name: Store coverage files
346349
uses: actions/upload-artifact@v4
@@ -658,14 +661,14 @@ jobs:
658661
shell: powershell
659662
- name: Run Powershell Tab Completion Tests
660663
run: |
661-
just test ./tests/verify_environment.py
662-
just test-powershell
663-
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
664+
just test ./tests/verify_environment.py; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
665+
.venv\Scripts\activate.ps1; cmd /c "pytest --cov-append ./tests/shellcompletion/test_shell_resolution.py::TestShellResolution::test_powershell"; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
666+
just test-powershell; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
664667
shell: powershell
665668
- name: Test CMD shell failure
666669
run: |
667670
call .venv\Scripts\activate
668-
pytest --cov-append ./tests/shellcompletion/test_shell_resolution.py::test_get_win_shell_failure
671+
pytest --cov-append ./tests/shellcompletion/test_shell_resolution.py::test_get_win_shell_failure || exit 1
669672
shell: cmd
670673
- name: Store coverage files
671674
uses: actions/upload-artifact@v4
@@ -727,9 +730,9 @@ jobs:
727730
- name: Run Powershell Tab Completion Tests
728731
run: |
729732
just test ./tests/verify_environment.py
730-
just test-pwsh
731-
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
732-
shell: powershell
733+
.venv\Scripts\activate.ps1; cmd /c "pytest --cov-append ./tests/shellcompletion/test_shell_resolution.py::TestShellResolution::test_pwsh"; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
734+
just test-pwsh; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
735+
shell: pwsh
733736
- name: Test CMD shell failure
734737
run: |
735738
call .venv\Scripts\activate

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023-2024 Brian Kohan
3+
Copyright (c) 2023-2025 Brian Kohan
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

doc/.readthedocs.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ build:
1111
tools:
1212
python: "3.12"
1313
jobs:
14-
post_create_environment:
15-
- pip install poetry
1614
post_install:
17-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry install -E rich --with docs
15+
- pip install uv
16+
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --group docs --link-mode=copy
1817

1918
# Build documentation in the docs/ directory with Sphinx
2019
sphinx:
2120
configuration: doc/source/conf.py
2221

2322
# Optionally build your docs in additional formats such as PDF and ePub
2423
formats:
25-
- pdf
24+
- pdf

doc/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Change Log
77
v3.1.0 (2024-03-xx)
88
===================
99

10+
* Fixed `Shell completion tests let failures through in CI <https://github.com/django-commons/django-typer/issues/194>`_
1011
* Fixed `fish completion installs should respect XDG_CONFIG_HOME <https://github.com/django-commons/django-typer/issues/193>`_
1112
* Fixed `zsh completion installs should respect ZDOTDIR <https://github.com/django-commons/django-typer/issues/192>`_
1213
* Implemented `Support Django 5.2 <https://github.com/django-commons/django-typer/issues/188>`_

doc/source/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import shutil
77
import django
88

9-
sys.path.append(str(Path(__file__).parent.parent / 'tests'))
10-
sys.path.append(str(Path(__file__).parent.parent / 'examples'))
9+
sys.path.append(str(Path(__file__).parent.parent.parent))
1110
sys.path.append(str(Path(__file__).parent / 'ext'))
1211

1312
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings.base')

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,14 @@ command_line = "-m pytest --cov=django_typer"
143143

144144
[tool.coverage.paths]
145145
source = [
146-
"django_typer"
146+
"src/django_typer"
147147
]
148148

149149
[tool.pyright]
150150
exclude = ["tests/**/*"]
151151
include = [
152-
"src/django_typer"
152+
"src/django_typer",
153+
"*/site-packages/django_typer"
153154
]
154155

155156
[tool.ruff]

src/django_typer/apps.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,25 @@ def check_traceback_config(app_configs, **kwargs) -> t.List[CheckMessage]:
3030
warnings: t.List[CheckMessage] = []
3131
if use_rich_tracebacks():
3232
tb_config = traceback_config()
33-
try:
34-
from rich import traceback # pyright: ignore[reportMissingImports]
33+
from rich import traceback # pyright: ignore[reportMissingImports]
3534

36-
expected = {
37-
"no_install",
38-
"short",
39-
*inspect.signature(traceback.install).parameters.keys(),
40-
}
41-
unexpected = set(tb_config.keys()) - expected
42-
if unexpected:
43-
warnings.append(
44-
CheckWarning(
45-
"DT_RICH_TRACEBACK_CONFIG",
46-
hint="Unexpected parameters encountered: {keys}.".format(
47-
keys=", ".join(unexpected)
48-
),
49-
obj=settings.SETTINGS_MODULE,
50-
id="django_typer.W001",
51-
)
35+
expected = {
36+
"no_install",
37+
"short",
38+
*inspect.signature(traceback.install).parameters.keys(),
39+
}
40+
unexpected = set(tb_config.keys()) - expected
41+
if unexpected:
42+
warnings.append(
43+
CheckWarning(
44+
"DT_RICH_TRACEBACK_CONFIG",
45+
hint="Unexpected parameters encountered: {keys}.".format(
46+
keys=", ".join(unexpected)
47+
),
48+
obj=settings.SETTINGS_MODULE,
49+
id="django_typer.W001",
5250
)
53-
except ImportError:
54-
pass
51+
)
5552
return warnings
5653

5754

tests/test_tracebacks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_default_traceback(self):
1919
]
2020
self.assertIn("Traceback (most recent call last)", result)
2121
self.assertIn("Exception: This is a test exception", result)
22-
if rich_installed:
22+
if self.rich_installed:
2323
self.assertIn("────────", result)
2424
# locals should not be present
2525
self.assertNotIn("name = 'me'", result)
@@ -54,7 +54,7 @@ def test_tb_command_overrides(self):
5454
)[1]
5555
self.assertIn("Traceback (most recent call last)", result)
5656
self.assertIn("Exception: This is a test exception", result)
57-
if rich_installed:
57+
if self.rich_installed:
5858
self.assertIn("────────", result)
5959
# locals should be present
6060
self.assertIn("name = 'me'", result)
@@ -114,7 +114,7 @@ def test_traceback_set_to_false(self):
114114
@override_settings(DT_RICH_TRACEBACK_CONFIG=True)
115115
def test_traceback_set_to_true(self):
116116
self.assertEqual(traceback_config(), {"show_locals": False})
117-
self.assertIs(use_rich_tracebacks(), rich_installed)
117+
self.assertIs(use_rich_tracebacks(), self.rich_installed)
118118

119119
@override_settings(DT_RICH_TRACEBACK_CONFIG=None)
120120
def test_traceback_set_to_none(self):
@@ -156,7 +156,7 @@ def test_traceback_no_locals_short_false(self):
156156
)[1]
157157
self.assertIn("Traceback (most recent call last)", result)
158158
self.assertIn("Exception: This is a test exception", result)
159-
if rich_installed:
159+
if self.rich_installed:
160160
self.assertIn("────────", result)
161161
self.assertGreater(len(re.findall(r"\.py:\d+", result) or []), 0)
162162

@@ -199,7 +199,7 @@ def test_colored_traceback(self):
199199
result = run_command(
200200
"test_command1", "--force-color", "delete", "Brian", "--throw"
201201
)[1]
202-
if rich_installed:
202+
if self.rich_installed:
203203
self.assertIn("\x1b", result)
204204

205205
result = run_command(

0 commit comments

Comments
 (0)