diff options
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 38 |
1 files changed, 30 insertions, 8 deletions
@@ -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.6, 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 """"""""" @@ -328,6 +342,7 @@ 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 +363,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 +372,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 ---------------------------- |