Skip to content

Commit

Permalink
Merge branch 'FactoryBoy:master' into allow-functions-as-models
Browse files Browse the repository at this point in the history
  • Loading branch information
instanceofmel committed Apr 26, 2024
2 parents c894d2c + d6349de commit 11b952d
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 14 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
GitHub_Actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
10 changes: 6 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Check

on:
- push
- pull_request
push:
branches:
- "master"
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -25,10 +27,10 @@ jobs:
TOXENV: ${{ matrix.tox-environment }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3'
cache: pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
name: Linkcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3'

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Test

on:
- push
- pull_request
push:
branches:
- "master"
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ testall:
tox

# DOC: Run tests for the currently installed version
# Remove cgi warning when dropping support for Django<=4.1.
# Remove cgi warning when dropping support for Django 3.2.
test:
mypy --ignore-missing-imports tests/test_typing.py
python \
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ChangeLog
*Removed:*

- Drop support for Django 4.0
- Stop advertising and verifying support for Django 4.1

3.3.0 (2023-07-19)
------------------
Expand Down
2 changes: 1 addition & 1 deletion factory/declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def evaluate_post(self, instance, step, overrides):
return target

def evaluate_pre(self, instance, step, overrides):
choice = self.decider.evaluate(instance=instance, step=step, extra={})
choice = self.decider.evaluate_pre(instance=instance, step=step, overrides={})
target = self.yes if choice else self.no
# The value can't be POST_INSTANTIATION, checked in __init__;
# evaluate it as `evaluate_pre`
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers =
Development Status :: 5 - Production/Stable
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.1
Framework :: Django :: 4.2
Framework :: Django :: 5.0
Intended Audience :: Developers
Expand Down
21 changes: 21 additions & 0 deletions tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,24 @@ class Params:

unknown_author = AuthorFactory(unknown=True)
self.assertEqual("", unknown_author.fullname)

def test_evaluated_without_locale(self):
"""Regression test for `KeyError: 'locale'` raised in `evaluate`.
See #965
"""
class AuthorFactory(factory.Factory):
fullname = factory.Faker("name")
pseudonym = factory.Maybe(
decider=factory.Faker("pybool"),
yes_declaration="yes",
no_declaration="no",
)

class Meta:
model = Author

author = AuthorFactory()

self.assertIn(author.pseudonym, ["yes", "no"])
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ envlist =
linkcheck
py{38,39,310,311,312,py39,py310}-sqlite
py{38,39,310,311,py39,py310}-django32-mongo-alchemy-{sqlite,postgres}
py{38,39,310,311,py39,py310}-django41-mongo-alchemy-{sqlite,postgres}
py{38,39,310,311,312}-django42-mongo-alchemy-{sqlite,postgres}
py{py39,py310}-django42-mongo-alchemy-sqlite,
# py{py39,py310}-django42-mongo-alchemy-postgres # TODO: Fix me!
Expand Down Expand Up @@ -39,9 +38,8 @@ deps =
alchemy: SQLAlchemy
alchemy: sqlalchemy_utils
mongo: mongoengine
django{32,41,42,50,main}: Pillow
django{32,42,50,main}: Pillow
django32: Django>=3.2,<3.3
django41: Django>=4.1,<4.2
django42: Django>=4.2,<5.0
django50: Django>=5.0,<5.1
djangomain: https://github.com/django/django/archive/main.tar.gz
Expand Down

0 comments on commit 11b952d

Please sign in to comment.