Skip to content
Closed
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
8 changes: 7 additions & 1 deletion pytest_factoryboy/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ def create_fixture_with_related(

# We have to set the `_factoryboy_related` attribute to the original function, since
# FixtureDef.func will provide that one later when we discover the related fixtures.
f.__pytest_wrapped__.obj._factoryboy_related = related # type: ignore[attr-defined]
if hasattr(f, "__pytest_wrapped__"):
f.__pytest_wrapped__.obj._factoryboy_related = related
elif hasattr(f, "__wrapped__"):
f.__wrapped__._factoryboy_related = related
else:
raise AttributeError("Fixture object has no __pytest_wrapped__ nor __wrapped__ attribute")

return f


Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
distshare = {homedir}/.tox/distshare
envlist = py{3.9,3.10,3.11,3.12,3.13}-pytest{7.3,7.4,8.0,8.1,8.2,8.3,latest,main}
envlist = py{3.9,3.10,3.11,3.12,3.13}-pytest{7.3,7.4,8.0,8.1,8.2,8.3,8.4,latest,main}
py{3.9,3.10,3.11}-pytest{7.0,7.1,7.2}
mypy

Expand All @@ -12,6 +12,7 @@ ignore_outcome =
deps =
pytestlatest: pytest
pytestmain: git+https://github.com/pytest-dev/pytest.git@main
pytest8.4: pytest~=8.4.0
pytest8.3: pytest~=8.3.0
pytest8.2: pytest~=8.2.0
pytest8.1: pytest~=8.1.0
Expand Down