Skip to content

Commit

Permalink
Bump factory-boy from 3.2.1 to 3.3.0 (#927)
Browse files Browse the repository at this point in the history
* Bump factory-boy from 3.2.1 to 3.3.0

Bumps [factory-boy](https://github.com/FactoryBoy/factory_boy) from 3.2.1 to 3.3.0.
- [Changelog](https://github.com/FactoryBoy/factory_boy/blob/master/docs/changelog.rst)
- [Commits](FactoryBoy/factory_boy@3.2.1...3.3.0)

---
updated-dependencies:
- dependency-name: factory-boy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix the factories that use postgeneration features.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Layman <matthewlayman@gmail.com>
  • Loading branch information
dependabot[bot] and mblayman authored Aug 1, 2023
1 parent 80ac7f3 commit 6b709b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions homeschool/courses/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class CourseFactory(factory.django.DjangoModelFactory):
class Meta:
model = "courses.Course"
skip_postgeneration_save = True

name = factory.Sequence(lambda n: f"Course {n}")

Expand Down
8 changes: 8 additions & 0 deletions homeschool/users/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ class Meta:
# By setting this here, UserFactory can be used to create staff and superusers
# that can still log in.
password = factory.PostGenerationMethodCall("set_password", "password")

@classmethod
def _after_postgeneration(cls, instance, create, results=None):
"""factory_boy is removing some functionality that will save instances
after post generation. To make sure the password from the hook above sticks,
call save to keep the desired behavior."""
if create:
instance.save()
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coverage[toml]
django-test-plus==2.2.3
factory-boy==3.2.1
factory-boy==3.3.0
flake8==6.1.0
flake8-bugbear==23.7.10
isort==5.5.4
Expand Down

0 comments on commit 6b709b2

Please sign in to comment.