summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst59
1 files changed, 41 insertions, 18 deletions
diff --git a/README.rst b/README.rst
index 9b82406..0e1f000 100644
--- a/README.rst
+++ b/README.rst
@@ -1,20 +1,24 @@
factory_boy
===========
-.. image:: https://pypip.in/version/factory_boy/badge.svg
+.. image:: https://secure.travis-ci.org/rbarrois/factory_boy.png?branch=master
+ :target: http://travis-ci.org/rbarrois/factory_boy/
+
+.. image:: https://img.shields.io/pypi/v/factory_boy.svg
:target: http://factoryboy.readthedocs.org/en/latest/changelog.html
:alt: Latest Version
-.. image:: https://pypip.in/py_versions/factory_boy/badge.svg
+.. image:: https://img.shields.io/pypi/pyversions/factory_boy.svg
:target: https://pypi.python.org/pypi/factory_boy/
:alt: Supported Python versions
-.. image:: https://pypip.in/wheel/factory_boy/badge.svg
+.. image:: https://img.shields.io/pypi/wheel/factory_boy.svg
:target: https://pypi.python.org/pypi/factory_boy/
:alt: Wheel status
-.. image:: https://secure.travis-ci.org/rbarrois/factory_boy.png?branch=master
- :target: http://travis-ci.org/rbarrois/factory_boy/
+.. image:: https://img.shields.io/pypi/l/factory_boy.svg
+ :target: https://pypi.python.org/pypi/factory_boy/
+ :alt: License
factory_boy is a fixtures replacement based on thoughtbot's `factory_girl <http://github.com/thoughtbot/factory_girl>`_.
@@ -74,8 +78,9 @@ Links
* Documentation: http://factoryboy.readthedocs.org/
* Repository: https://github.com/rbarrois/factory_boy
* Package: https://pypi.python.org/pypi/factory_boy/
+* Mailing-list: `factoryboy@googlegroups.com <mailto:factoryboy@googlegroups.com>`_ | https://groups.google.com/forum/#!forum/factoryboy
-factory_boy supports Python 2.6, 2.7, 3.2 and 3.3, as well as PyPy; it requires only the standard Python library.
+factory_boy supports Python 2.7, 3.2 to 3.5, as well as PyPy; it requires only the standard Python library.
Download
@@ -181,7 +186,7 @@ It is also possible to create a bunch of objects in a single call:
Realistic, random values
""""""""""""""""""""""""
-Tests look better with random yet realistic values.
+Demos look better with random yet realistic values; and those realistic values can also help discover bugs.
For this, factory_boy relies on the excellent `fake-factory <https://pypi.python.org/pypi/fake-factory>`_ library:
.. code-block:: python
@@ -199,6 +204,10 @@ For this, factory_boy relies on the excellent `fake-factory <https://pypi.python
<User: Lucy Murray>
+.. note:: Use of fully randomized data in tests is quickly a problem for reproducing broken builds.
+ To that purpose, factory_boy provides helpers to handle the random seeds it uses.
+
+
Lazy Attributes
"""""""""""""""
@@ -217,6 +226,7 @@ These "lazy" attributes can be added as follows:
first_name = 'Joe'
last_name = 'Blow'
email = factory.LazyAttribute(lambda a: '{0}.{1}@example.com'.format(a.first_name, a.last_name).lower())
+ date_joined = factory.LazyFunction(datetime.now)
.. code-block:: pycon
@@ -224,6 +234,10 @@ These "lazy" attributes can be added as follows:
"joe.blow@example.com"
+.. note:: ``LazyAttribute`` calls the function with the object being constructed as an argument, when
+ ``LazyFunction`` does not send any argument.
+
+
Sequences
"""""""""
@@ -278,6 +292,17 @@ The associated object's strategy will be used:
True
+ORM Support
+"""""""""""
+
+factory_boy has specific support for a few ORMs, through specific ``factory.Factory`` subclasses:
+
+* Django, with ``factory.django.DjangoModelFactory``
+* Mogo, with ``factory.mogo.MogoFactory``
+* MongoEngine, with ``factory.mongoengine.MongoEngineFactory``
+* SQLAlchemy, with ``factory.alchemy.SQLAlchemyModelFactory``
+
+
Debugging factory_boy
"""""""""""""""""""""
@@ -312,22 +337,13 @@ This will yield messages similar to those (artificial indentation):
BaseFactory: Generating tests.test_using.TestModel2Factory(two=<tests.test_using.TestModel object at 0x1e15410>)
-ORM Support
-"""""""""""
-
-factory_boy has specific support for a few ORMs, through specific ``factory.Factory`` subclasses:
-
-* Django, with ``factory.django.DjangoModelFactory``
-* Mogo, with ``factory.mogo.MogoFactory``
-* MongoEngine, with ``factory.mongoengine.MongoEngineFactory``
-* SQLAlchemy, with ``factory.alchemy.SQLAlchemyModelFactory``
-
Contributing
------------
factory_boy is distributed under the MIT License.
Issues should be opened through `GitHub Issues <http://github.com/rbarrois/factory_boy/issues/>`_; whenever possible, a pull request should be included.
+Questions and suggestions are welcome on the `mailing-list <mailto:factoryboy@googlegroups.com>`_.
All pull request should pass the test suite, which can be launched simply with:
@@ -348,7 +364,7 @@ To test with a specific framework version, you may use:
.. code-block:: sh
- $ make DJANGO=1.7 test
+ $ make DJANGO=1.9 test
Valid options are:
@@ -357,6 +373,13 @@ Valid options are:
* ``ALCHEMY`` for ``SQLAlchemy``
+To avoid running ``mongoengine`` tests (e.g no mongo server installed), run:
+
+.. code-block:: sh
+
+ $ make SKIP_MONGOENGINE=1 test
+
+
Contents, indices and tables
----------------------------