Skip to content

Commit

Permalink
Merge pull request #125 from paulocheque/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes: default value and number of laps equals to 0
  • Loading branch information
paulocheque committed Mar 2, 2020
2 parents bd253b5 + 1c0aa01 commit 830b1b5
Show file tree
Hide file tree
Showing 14 changed files with 300 additions and 162 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,40 @@ matrix:
env:
- DJANGO=1.11
- DATABASE=sqlite
- JSONFIELD=2.1.1
- python: 2.7
env:
- DJANGO=1.11
- DATABASE=postgres
- JSONFIELD=2.1.1
# https://docs.djangoproject.com/en/2.2/ref/contrib/gis/install/
- python: 3.6
env:
- DJANGO=2.2
- DATABASE=sqlite
- JSONFIELD=3.1.0
- python: 3.6
env:
- DJANGO=2.2
- DATABASE=postgres
- JSONFIELD=3.1.0
# https://docs.djangoproject.com/en/3.0/ref/contrib/gis/install/
# https://docs.djangoproject.com/en/3.0/releases/3.0/#id2
- python: 3.7
env:
- DJANGO=3.0
- DATABASE=sqlite
- JSONFIELD=3.1.0
- python: 3.8
env:
- DJANGO=3.0
- DATABASE=sqlite
- JSONFIELD=3.1.0
- python: 3.8
env:
- DJANGO=3.0
- DATABASE=postgres
- JSONFIELD=3.1.0

before_script:
- export PYTHONPATH=$PYTHONPATH:$(pwd)
Expand All @@ -76,6 +83,7 @@ install:
- pip install -r requirements.txt
- pip install psycopg2 pytest pytest-django coveralls
- pip install Django~=${DJANGO}.0
- pip install jsonfield~=${JSONFIELD}

script:
- pytest --create-db --reuse-db --no-migrations --ds=settings_${DATABASE}
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ compile:

test:
# Run specific test:
# TESTS=pytest django_dynamic_fixture.tests.FILE::CLASS::METHOD make test
# TESTS=django_dynamic_fixture.tests.FILE::CLASS::METHOD make test
clear ; env/bin/pytest --create-db --reuse-db --no-migrations ${TESTS}
# clear ; time env/bin/tox --parallel all -e django111-py27
# clear ; time env/bin/tox --parallel all -e django20-py37

testfailed:
clear ; env/bin/pytest --create-db --reuse-db --no-migrations ${TESTS} --last-failed

config_postgres:
psql -U postgres -c "create extension postgis"
# set up postgresql
Expand Down
8 changes: 4 additions & 4 deletions django_dynamic_fixture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django_dynamic_fixture.django_helper import print_field_values, django_greater_than
from django_dynamic_fixture.fixture_algorithms.sequential_fixture import SequentialDataFixture, \
StaticSequentialDataFixture
from django_dynamic_fixture.global_settings import DDF_DEFAULT_DATA_FIXTURE, DDF_FILL_NULLABLE_FIELDS, DDF_NUMBER_OF_LAPS, \
from django_dynamic_fixture.global_settings import DDF_DEFAULT_DATA_FIXTURE, DDF_FILL_NULLABLE_FIELDS, DDF_FK_MIN_DEPTH, \
DDF_IGNORE_FIELDS, DDF_VALIDATE_MODELS, \
DDF_DEBUG_MODE, DDF_FIELD_FIXTURES
from django_dynamic_fixture.script_ddf_checkings import ddf_check_models
Expand Down Expand Up @@ -75,7 +75,7 @@ def fixture(**kwargs):
f = DynamicFixture(data_fixture=kwargs.pop('data_fixture', DDF_DEFAULT_DATA_FIXTURE),
fill_nullable_fields=kwargs.pop('fill_nullable_fields', DDF_FILL_NULLABLE_FIELDS),
ignore_fields=kwargs.pop('ignore_fields', []),
number_of_laps=kwargs.pop('number_of_laps', DDF_NUMBER_OF_LAPS),
fk_min_depth=kwargs.pop('fk_min_depth', DDF_FK_MIN_DEPTH),
validate_models=kwargs.pop('validate_models', DDF_VALIDATE_MODELS),
print_errors=kwargs.pop('print_errors', True),
debug_mode=kwargs.pop('debug_mode', DDF_DEBUG_MODE),
Expand All @@ -98,7 +98,7 @@ def _new(model, n=1, ddf_lesson=None, persist_dependencies=False, **kwargs):
@data_fixture: override DDF_DEFAULT_DATA_FIXTURE configuration. Default is SequentialDataFixture().
@fill_nullable_fields: override DDF_FILL_NULLABLE_FIELDS global configuration. Default is True.
@ignore_fields: List of fields that will be ignored by DDF. It will be concatenated with the global list DDF_IGNORE_FIELDS. Default is [].
@number_of_laps: override DDF_NUMBER_OF_LAPS global configuration. Default 1.
@fk_min_depth: override DDF_FK_MIN_DEPTH global configuration. Default 0.
@validate_models: override DDF_VALIDATE_MODELS global configuration. Default is False.
@print_errors: print on console all instance values if DDF can not generate a valid object with the given configuration.
Expand Down Expand Up @@ -128,7 +128,7 @@ def _get(model, n=1, ddf_lesson=None, **kwargs):
@data_fixture: override DDF_DEFAULT_DATA_FIXTURE configuration. Default is SequentialDataFixture().
@fill_nullable_fields: override DDF_FILL_NULLABLE_FIELDS global configuration. Default is True.
@ignore_fields: List of fields that will be ignored by DDF. It will be concatenated with the global list DDF_IGNORE_FIELDS. Default is [].
@number_of_laps: override DDF_NUMBER_OF_LAPS global configuration. Default 1.
@fk_min_depth: override DDF_FK_MIN_DEPTH global configuration. Default 0.
@validate_models: override DDF_VALIDATE_MODELS global configuration. Default is False.
@print_errors: print on console all instance values if DDF can not generate a valid object with the given configuration.
Expand Down

0 comments on commit 830b1b5

Please sign in to comment.