Skip to content
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
25 changes: 12 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ jobs:
ignore-test-outcome: false
- python-version: "3.10"
toxfactor: py3.10
ignore-typecheck-outcome: true
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.11"
toxfactor: py3.11
ignore-typecheck-outcome: true
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.12"
toxfactor: py3.12
ignore-typecheck-outcome: true
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.13"
toxfactor: py3.13
ignore-typecheck-outcome: true
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.14"
toxfactor: py3.14
ignore-typecheck-outcome: true
ignore-typecheck-outcome: false
ignore-test-outcome: false
steps:
- uses: actions/checkout@v4
Expand All @@ -71,17 +71,17 @@ jobs:
python -m pip install poetry==2.0.0
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
poetry config virtualenvs.in-project true
- name: Cache the virtualenv
id: poetry-dependencies-cache
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}${{ hashFiles('.github/workflows/**') }}
- name: Install dev dependencies
if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true'
run: |
python -m poetry install --only=dev
poetry install
- name: Download artifact
uses: actions/download-artifact@v4
with:
Expand All @@ -91,16 +91,15 @@ jobs:
# Ignore errors for older pythons
continue-on-error: ${{ matrix.ignore-typecheck-outcome }}
run: |
source .venv/bin/activate
tox -e mypy
poetry run mypy pytest_factoryboy
- name: Test with tox
continue-on-error: ${{ matrix.ignore-test-outcome }}
run: |
source .venv/bin/activate
coverage erase
# Using `--parallel 4` as it's the number of CPUs in the GitHub Actions runner
# Using `installpkg dist/*.whl` because we want to install the pre-built package (want to test against that)
tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --parallel-no-spinner --parallel-live --installpkg dist/*.whl
# Using `--parallel 4` as it's the number of CPUs in the GitHub Actions runner
# Using `installpkg dist/*.whl` because we want to install the pre-built package (want to test against that)
tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --parallel-no-spinner --parallel-live --installpkg dist/*.whl
coverage combine
coverage xml
- uses: codecov/codecov-action@v4
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Added
* Declare compatibility with python 3.13. Supported versions are now: 3.9, 3.10, 3.11, 3.12, 3.13.
* Test against pytest 8.4
* Test against python 3.14 (beta)
* Run static type checks.

Changed
+++++++
Expand All @@ -51,6 +52,7 @@ Removed
Fixed
+++++
* Fix compatibility with ``pytest 8.4``.
* Fixed internal type annotations.

Security
++++++++
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ check_untyped_defs = true
disallow_untyped_decorators = true
disallow_any_explicit = false
disallow_any_generics = true
disallow_untyped_calls = true
disallow_untyped_calls = false
disallow_untyped_defs = true
ignore_errors = false
ignore_missing_imports = true
Expand Down
16 changes: 11 additions & 5 deletions pytest_factoryboy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@
try:
from factory.declarations import PostGenerationContext
except ImportError: # factory_boy < 3.2.0
from factory.builder import PostGenerationContext
from factory.builder import ( # type: ignore[attr-defined, no-redef]
PostGenerationContext,
)

if pytest_version.release >= (8, 1):

def getfixturedefs(fixturemanager: FixtureManager, fixturename: str, node: Node) -> Sequence[FixtureDef] | None:
def getfixturedefs(
fixturemanager: FixtureManager, fixturename: str, node: Node
) -> Sequence[FixtureDef[object]] | None:
return fixturemanager.getfixturedefs(fixturename, node)

else:

def getfixturedefs(fixturemanager: FixtureManager, fixturename: str, node: Node) -> Sequence[FixtureDef] | None:
return fixturemanager.getfixturedefs(fixturename, node.nodeid)
def getfixturedefs(
fixturemanager: FixtureManager, fixturename: str, node: Node
) -> Sequence[FixtureDef[object]] | None:
return fixturemanager.getfixturedefs(fixturename, node.nodeid) # type: ignore[arg-type]


if pytest_version.release >= (8, 4):
Expand All @@ -35,4 +41,4 @@ def getfixturedefs(fixturemanager: FixtureManager, fixturename: str, node: Node)
else:
from _pytest.fixtures import FixtureFunction

PytestFixtureT: TypeAlias = FixtureFunction
PytestFixtureT: TypeAlias = FixtureFunction # type: ignore[misc, no-redef]
Loading
Loading