Skip to content

Commit

Permalink
Merge pull request #111 from paulocheque/doc
Browse files Browse the repository at this point in the history
Better documentation
  • Loading branch information
paulocheque committed Jan 5, 2020
2 parents af8a144 + 0d0fd0c commit a773737
Show file tree
Hide file tree
Showing 15 changed files with 629 additions and 524 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from datetime import datetime, date
from decimal import Decimal
import six
from six.moves import xrange


class DataFixtureTestCase(object):
Expand All @@ -23,7 +22,7 @@ def test_numbers(self):

def test_it_must_deal_with_decimal_max_digits(self):
# value 10 must be a problem, need to restart the counter: 10.0 has 3 digits
for _ in xrange(11):
for _ in range(11):
assert isinstance(self.fixture.generate_data(models.DecimalField(max_digits=1, decimal_places=1)), Decimal)
assert isinstance(self.fixture.generate_data(models.DecimalField(max_digits=2, decimal_places=1)), Decimal)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django_dynamic_fixture.fixture_algorithms.tests.abstract_test_generic_fixture import DataFixtureTestCase
from django_dynamic_fixture.fixture_algorithms.unique_random_fixture import \
UniqueRandomDataFixture
from six.moves import xrange


class RandomDataFixtureTestCase(TestCase, DataFixtureTestCase):
Expand All @@ -16,7 +15,7 @@ def setUp(self):

def test_generated_strings_are_unique(self):
results = set()
for _ in xrange(self.fixture.OBJECT_COUNT):
for _ in range(self.fixture.OBJECT_COUNT):
results.add(
self.fixture.generate_data(models.CharField(max_length=10))
)
Expand All @@ -25,7 +24,7 @@ def test_generated_strings_are_unique(self):
def test_generated_signed_integers_are_unique(self):
results = set()
prev = 0
for _ in xrange(self.fixture.OBJECT_COUNT):
for _ in range(self.fixture.OBJECT_COUNT):
integer = self.fixture.generate_data(models.IntegerField())
results.add(integer)
assert abs(integer) > abs(prev)
Expand All @@ -35,7 +34,7 @@ def test_generated_signed_integers_are_unique(self):
def test_generated_unsigned_integers_are_unique(self):
results = set()
prev = 0
for _ in xrange(self.fixture.OBJECT_COUNT):
for _ in range(self.fixture.OBJECT_COUNT):
integer = self.fixture.generate_data(models.PositiveIntegerField())
results.add(integer)
assert integer > prev
Expand All @@ -44,7 +43,7 @@ def test_generated_unsigned_integers_are_unique(self):

def test_warning(self):
with catch_warnings(record=True) as w:
for _ in xrange(self.fixture.OBJECT_COUNT + 1):
for _ in range(self.fixture.OBJECT_COUNT + 1):
self.fixture.generate_data(models.CharField(max_length=10))
warning = w[-1]
assert issubclass(warning.category, RuntimeWarning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from warnings import warn

import six
from six.moves import xrange

from django.core.exceptions import ImproperlyConfigured

Expand Down Expand Up @@ -53,7 +52,7 @@ def random_string(self, field, key, n=None):
result = counter
result += six.text_type('').join(
random.choice(string.ascii_letters)
for _ in xrange(length - len(counter))
for _ in range(length - len(counter))
)
return result

Expand Down
247 changes: 23 additions & 224 deletions docs/source/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,232 +3,16 @@
About
*******************************************************************************

.. contents::
:local:

Change Log
===============================================================================

Date format: yyyy/mm/dd

Version 2.0.0 - 2017/12/08
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/2.0.0>
* `DDF_IGNORE_FIELDS` globally for all new instances
* Bugfix for auto generated `_ptr` fields.
* Support for Django 2.0.0.

Version 1.9.5 - 2017/05/09
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.9.5>
* Bugfix: avoid GDALException on Django 1.11

Version 1.9.4 - 2017/04/17
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.9.4>
* Added support for django.contrib.postgres.fields.ArrayField field
* Fixed GeoDjango Point instantiation.

Version 1.9.3 - 2017/03/08
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.9.3>
* Improve compatibility for the DDF internal tests

Version 1.9.2 - 2017/03/08
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.9.2>
* Django 2.0 compatibility
* New: Support for wildcards `?` and `*` in the ignore fields
* Bugfix: Fixed DDF_TEST_GEODJANGO test issues

Version 1.9.1 - 2016/12/21
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.9.1>
* Bugfix: Django version parser
* Bugfix: NameError on invalid variable name

Version 1.9.0 - 2016/05/23
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.9.0>
* [New] Django 1.9 support
* [Bugfix] Fixed issue on ForeignKey field with default id
* [Bugfix] Fixed issue with SimpleUploadedFile

Version 1.8.4 - 2015/05/26
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.8.4>
* [New] UUIDField support
* [New] GeoDjango fields support (GeometryField, PointField, LineStringField, PolygonField, MultiPointField, MultiLineStringField, MultiPolygonField, GeometryCollectionField)
* [Update] Better error messages
* [Bugfix] BinaryField fixture fix
* [Update] Optimizations


Version 1.8.3 - 2015/05
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.8.3>
* [Update] No more deprecated methods


Version 1.8.2 - 2015/05
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.8.2>
* [New] Support for Django 1.8


Version 1.8.1 - 2014/12
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.8.1>
* [Update] Avoid conflicts with "instance" and "field" model field names.

Version 1.8.0 - 2014/09
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.8.0>
* [New] DDF_FIELD_FIXTURES global settings. You can include support of other fields here.
* [New] Support for BinaryField
* [Update] Django 1.7, Python 3.4 and Pypy official suppport (fixed some tests)
* [New] ReadTheDocs full documentation
* [Update] Fixed some print calls for python 3
* [Update] Nose plugin disable as default. Recommended behavior of nose plugins.
* [Update] ignore_fields parameter does not consider fields explicitly defined by the developer.
* [Update] Travis env using Tox

Version 1.7.0 - 2014/03/26
-------------------------------------------------------------------------------

* <http://pypi.python.org/pypi/django-dynamic-fixture/1.7.0>

Version 1.6.4 - 2012/12/30
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.6.4>
* [Bugfix] auto_now and auto_now_add must not be disabled forever (thanks for reporting)
* [New] Added global_sequential data fixture (Pull request, thanks)

Version 1.6.3 - 2012/04/10
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.6.3>
* [New] Pre save and post save special signals

Version 1.6.2 - 2012/04/09
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.6.2>
* [New] Debug Mode and option (global/local) to enable/disable debug mode

Version 1.6.1 - 2012/04/07
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.6.1>
* [New] New alias for F: field1__field2=value instead of field1=F(field2=value)
* [New] Named shelves inherit from default shelve

Version 1.6.0 - 2012/03/31
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.6.0>
* [New] Copier: option to copy a generated value for a field to another one. Useful for denormalizated fields.
* [New] Shelve/Library: option to store a default configuration of a specific model. Useful to avoid replicated code of fixtures. Global option: DDF_USE_LIBRARY.
* [New] Named Shelve: option to store multiple configurations for a model in the library.
* [New] Nose plugin for global set up.
* [New] P function now accept a queryset.

Version 1.5.1 - 2012/03/26
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.5.0>
* [New] global option: DDF_VALIDATE_ARGS that enable or disable field names.
* [Bugfix] F feature stop working.

Version 1.5.0 - 2012/03/25
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.5.0>
* [New] global settings: DDF_DEFAULT_DATA_FIXTURE, DDF_FILL_NULLABLE_FIELDS, DDF_IGNORE_FIELDS, DDF_NUMBER_OF_LAPS, DDF_VALIDATE_MODELS
* [New] new data fixture that generates random data
* [New] new data fixture that use sequential numbers only for fields that have unique=True
* [New] P function now accept a list of model instances
* [New] Option to call model_instance.full_clean() validation method before saving the object (DDF_VALIDATE_MODELS).
* [New] Validate field names. If a invalid field name is passed as argument, it will raise an InvalidConfigurationError exception.
* [Bugfix] DateField options 'auto_add_now' and 'auto_add' are disabled if a custom value is used.

Version 1.4.3 - 2012/02/23
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.4.3>
* [Bugfix] Bugfix in ForeignKeys with default values

Version 1.4.2 - 2011/11/07
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.4.2>
* [Bugfix] Bugfix in FileSystemDjangoTestCase

Version 1.4.1 - 2011/11/07
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.4.1>
* [New] Now you can set a custom File to a FileField and the file will be saved in the file storage system.
* **FileSystemDjangoTestCase**:
* [New] create_django_file_using_file create a django.File using the content of your file
* [New] create_django_file_with_temp_file now accepts a content attribute that will be saved in the generated file
* [Bugfix] now create_django_file_with_temp_file close the generated file

Version 1.4.0 - 2011/10/29
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.4.0>
* [New] Nose plugin to count queries on each test
* [New] Command line to count queries on the save (insert and update) of each model
* [Update] Field with choice and default must use the default value, not the first choice value
* [Update] Validation if the class is a models.Model instance
* [Update] Showing all stack trace, when an exception occurs

* **Decorators**:
* [Bugfix] default values of database engines were not used correctly
* **FileSystemDjangoTestCase**:
* [Testfix] Fixing tests

Version 1.3.1 - 2011/10/03
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.3.1>
* [Bugfix] Bugfixes in FileSystemDjangoTestCase

Version 1.3.0 - 2011/10/03
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.3.0>
* [New] File System Django Test Case
* [New] Decorators skip_for_database and only_for_database
* [Bugfix] Inheritance problems, before this version the DDF filled fields with the attribute parent_link

Version 1.2.3 - 2011/06/27
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.2.3>
* [Bugfix] string truncation to max_length

Version 1.2.2 - 2011/05/05
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.2.2>
* [Update] Improvements in exception messages

Version 1.2.1 - 2011/03/11
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.2.1>
* [Bugfix] Propagate ignored fields to self references
* [Refact] Refactoring

Version 1.2 - 2011/03/04
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.2>
* [New] ignore_fields
* [New] now it is possible to set the ID

Version 1.1
-------------------------------------------------------------------------------
* <http://pypi.python.org/pypi/django-dynamic-fixture/1.0> (1.0 has the 1.1 package)
* [Bugfix] Bug fixes for 1.0

Version 1.0
-------------------------------------------------------------------------------
* Initial version
* Ready to use in big projects

Collaborators
===============================================================================

Paulo Cheque <http://twitter.com/paulocheque> <https://github.com/paulocheque>

Valder Gallo <http://valdergallo.com.br> <https://github.com/valdergallo>

Julio Netto <http://www.inerciasensorial.com.br> <https://bitbucket.org/inerte>
* Paulo Cheque <https://paulocheque.codeart.io> <https://github.com/paulocheque> - Master Dissertation about Automated Test Patterns: https://teses.usp.br/teses/disponiveis/45/45134/tde-02042012-120707/pt-br.php
* Valder Gallo <http://valdergallo.com.br> <https://github.com/valdergallo>
* Julio Netto <http://www.inerciasensorial.com.br> <https://bitbucket.org/inerte>


Pull Requests tips
Expand Down Expand Up @@ -267,9 +51,6 @@ Tests and Bugfixes
* tests with proxy models
* tests with GenericRelations, GenericForeignKey etc
* more tests with OneToOneField(parent_link=True)
* Test with python 2.4
* Test with python 2.5
* Test with python 3.*

Features
-------------------------------------------------------------------------------
Expand All @@ -282,3 +63,21 @@ Documentation
-------------------------------------------------------------------------------
* with_queries documentation
* example to generate models with validators in fields or in clean methods

External references
===============================================================================

* http://stackoverflow.com/search?q=django+dynamic+fixture
* http://stackoverflow.com/questions/12487337/optimizing-setup-and-teardown-for-sample-django-model-using-django-nose-and-djan
* http://stackoverflow.com/questions/4400609/initial-data-fixture-management-in-django


Running tests locally
===============================================================================

Install GDAL: https://docs.djangoproject.com/en/1.11/ref/contrib/gis/install/geolibs/#gdal

Commands::

make build
make tox

0 comments on commit a773737

Please sign in to comment.