Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
charlax committed Feb 18, 2015
1 parent 01003da commit b820c5f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
22 changes: 22 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
Changelog for Charlatan
=======================

0.4.0 (unreleased)
------------------

- **Breaking change**: ``get_builder`` and ``delete_builder`` arguments were
added to :py:class:`charlatan.FixturesManager`.
- **Breaking change**: ``delete_instance``, ``save_instance`` methods were
deleted in favor of using builders (see below).
- **Breaking change**: ``fields`` argument on
:py:class:`charlatan.fixture.Fixture` and fixtures collection class has
been renamed ``overrides`` for consistency reasons.
- **Breaking change**: deleting fixtures will not return anything. It used to
return the fixture or list of fixtures that were successfully deleted. It has
been removed to apply the command query separation pattern. There are other
ways to check which fixtures are installed, and hooks or builders can be used
to customize deletion.
- **Breaking change**: ``do_not_save`` and ``do_not_delete`` arguments have
been removed from all functions, in favor of using builders.
- The notion of :py:class:`charlatan.builder.Builder` was added. This allows
customizing how fixtures are instantiated and installed. A ``builder``
argument has been added to most method dealing with getting, installing or
deleting fixtures. Sane defaults have been added in most places.

0.3.12 (2015-01-14)
-------------------

Expand Down
4 changes: 4 additions & 0 deletions charlatan/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def __call__(self, fixtures, klass, params, **kwargs):
:param klass: the fixture's class (``model`` in the definition file)
:param params: the fixture's params (``fields`` in the definition
file)
:param dict kwargs:
``kwargs`` allows passing arguments to the builder to change its
behavior.
"""
raise NotImplementedError

Expand Down
13 changes: 13 additions & 0 deletions charlatan/fixtures_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ class FixturesManager(object):
:param func get_builder:
:param func delete_builder:
.. versionadded:: 0.4.0
``get_builder`` and ``delete_builder`` arguments were added.
.. deprecated:: 0.4.0
``delete_instance``, ``save_instance`` methods were deleted in favor
of using builders.
.. versionadded:: 0.3.0
``db_session`` argument was added.
"""
Expand Down Expand Up @@ -397,6 +404,9 @@ def get_fixtures(self, fixture_keys, builder=None):
:rtype: list of instantiated but unsaved fixtures
.. versionadded:: 0.4.0
``builder`` argument was added.
.. deprecated:: 0.3.7
``include_relationships`` argument was removed.
"""
Expand All @@ -413,6 +423,9 @@ def get_all_fixtures(self, fixture_keys, builder=None):
:rtype: list of instantiated but unsaved fixtures
.. versionadded:: 0.4.0
``builder`` argument was added.
.. deprecated:: 0.3.7
``include_relationships`` argument was removed.
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/builders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ your own builders and provide them as arguments when you instantiate
Example
-------

Here's an example inspired by the schematics library, which expect a dict of
Here's an example inspired by the schematics library, which expects a dict of
attributes as a single instantiation argument:

.. literalinclude:: ../charlatan/tests/example/test_custom_builder.py
Expand Down

0 comments on commit b820c5f

Please sign in to comment.