Skip to content

Commit

Permalink
Run pyright as part of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed Sep 21, 2024
1 parent 7da9998 commit 1ac6257
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ jobs:
pip install -r requirements.txt
pip install "Django~=${{ matrix.django-version }}.0" .
- name: Run mypy
- name: Run type checking
run: |
python -m mypy dj_database_url
python -m pyright dj_database_url
- name: Run Tests
run: |
Expand All @@ -52,8 +53,9 @@ jobs:
- uses: codecov/codecov-action@v3

- name: Check mypy types installation
- name: Check types installation
run: |
pip install .
cd tests
python -m mypy .
python -m pyright .
2 changes: 1 addition & 1 deletion dj_database_url/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Register database schemes in URLs.
for key in SCHEMES.keys():
urlparse.uses_netloc.append(key)
del key
del key # pyright: ignore[reportPossiblyUnboundVariable]


# From https://docs.djangoproject.com/en/4.0/ref/settings/#databases
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ show_error_codes=true
disallow_untyped_defs=true
disallow_untyped_calls=true
warn_redundant_casts=true

[tool.pyright]
typeCheckingMode = "strict"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage
mypy
pyright
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from setuptools import setup
from setuptools import setup # pyright: ignore[reportUnknownVariableType]

readme = Path("README.rst").read_text()

Expand Down
2 changes: 2 additions & 0 deletions tests/test_dj_database_url.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pyright: reportTypedDictNotRequiredAccess=false

import os
import unittest
from unittest import mock
Expand Down

0 comments on commit 1ac6257

Please sign in to comment.