NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2861 most downloaded on PyPI
A collection of helpers and mock objects for unit tests and doc tests.
Last release 2 months ago
08 Jul 2026
Ships unpredictably
gaps range from 9 days to 13 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
18 years old
147 releases · first in 2008
Fix bug when using unittest.mock.patch and any of the testfixtures decorators at the same time and where the object being patched in was not hashable.
Fix bug when using unittest.mock.patch and any of the testfixtures decorators at the same time and where the object being patched in was not hashable.
Add official support for Python 3.7.
Add official support for Python 3.7.
Drop official support for Python 3.5.
Introduce a facade for unittest.mock at testfixtures.mock, including an important bug fix for ~unittest.mock.call objects.
Better feedback when ~unittest.mock.call comparisons fail when using compare.
A re-working of ~testfixtures.popen.MockPopen to enable it to handle multiple processes being active at the same time.
Fixes to datetime documentation.
Thanks to Augusto Wagner Andreoli for his work on the datetime documentation.
One column per quarter.
Allow the behaviour specified with ~testfixtures.popen.MockPopen.set_command to be a callable meaning that mock behaviour can now be dynamic based on
Allow the behaviour specified with ~testfixtures.popen.MockPopen.set_command to be a callable meaning that mock behaviour can now be dynamic based on the command executed and whatever was sent to stdin.
Make ~testfixtures.popen.MockPopen more accurately reflect subprocess.Popen on Python 3 by adding timeout parameters to ~testfixtures.popen.MockPopenInstance.wait and ~testfixtures.popen.MockPopenInstance.communicate along with some other smaller changes.
Thanks to Tim Davies for his work on ~testfixtures.popen.MockPopen.
Better rendering of differences between bytes when using compare on Python 3.
Better rendering of differences between bytes when using compare on Python 3.
Support filtering for specific warnings with ShouldWarn.
Support filtering for specific warnings with ShouldWarn.
Fix nasty bug where objects that had neither __dict__ nor __slots__ would always be considered equal by compare.
Fix nasty bug where objects that had neither __dict__ nor __slots__ would always be considered equal by compare.
Fix a bug when comparing equal set instances using compare when strict==True.
Fix a bug when comparing equal set instances using compare when strict==True.
compare will now handle objects that do not natively support equality or inequality and will treat these objects as equal if they are of the same type
compare will now handle objects that do not natively support equality or inequality and will treat these objects as equal if they are of the same type and have the same attributes as found using vars or __slots__. This is a change in behaviour which, while it could conceivably cause tests that are currently failing to pass, should not cause any currently passing tests to start failing.
Add support for writing to the stdin of ~testfixtures.popen.MockPopen instances.
The default behaviour of ~testfixtures.popen.MockPopen can now be controlled by providing a callable.
LogCapture.actual is now part of the documented public interface.
Add LogCapture.check_present to help with assertions about a sub-set of messages logged along with those that are logged in a non-deterministic order.
Comparison now supports objects with __slots__.
Added ShouldAssert as a simpler tool for testing test helpers.
Changed the internals of the various decorators testfixtures provides such that they can be used in conjunction with unittest.mock.patch on the same test method or function.
Changed the internals of ShouldRaise and Comparison to make use of compare and so provide nested comparisons with better feedback. This finally allows ShouldRaise to deal with Django's ~django.core.exceptions.ValidationError.
Added handling of self-referential structures to compare by treating all but the first occurence as equal. Another change needed to support Django's insane ~django.core.exceptions.ValidationError.
Thanks to Hamish Downer and Tim Davies for their work on ~testfixtures.popen.MockPopen.
Thanks to Wim Glenn and Daniel Fortunov for their help reviewing some of the more major changes.
Add explicit support for ~unittest.mock.Mock to compare.
Add explicit support for ~unittest.mock.Mock to compare.
Fix missing support for the start_new_session parameter to ~testfixtures.popen.MockPopen.
Fix missing support for the start_new_session parameter to ~testfixtures.popen.MockPopen.
Add pytest traceback hiding for TempDirectory.compare.
Add pytest traceback hiding for TempDirectory.compare.
Add warnings that log_capture, tempdir and replace are not currently compatible with pytest's fixtures mechanism.
Better support for stdout or stderr not being set to PIPE when using ~testfixtures.popen.MockPopen.
Add support to ~testfixtures.popen.MockPopen for using subprocess.Popen as a context manager in Python 3.
Add support to ~testfixtures.popen.MockPopen for stderr=STDOUT.
Thanks to Tim Davies for his work on ~testfixtures.popen.MockPopen.
test_datetime and test_time now accept a ~datetime.datetime instance during instantiation to set the initial value.
test_datetime and test_time now accept a ~datetime.datetime instance during instantiation to set the initial value.
test_date now accepts a ~datetime.date instance during instantiation to set the initial value.
Relax the restriction on adding, setting or instantiating test_datetime with tzinfo such that if the tzinfo matches the one configured, then it's okay to add. This means that you can now instantiate a test_datetime with an existing ~datetime.datetime instance that has tzinfo set.
testfixtures.django.compare_model now ignores many to many fields rather than blowing up on them.
Drop official support for Python 3.4, although things should continue to work.
Fix support for Django 1.9 in testfixtures.django.compare_model.
Fix support for Django 1.9 in testfixtures.django.compare_model.
Added support for including non-edit able fields to the comparer used by compare when comparing django ~django.db.models.Model instances.
Added support for including non-edit able fields to the comparer used by compare when comparing django ~django.db.models.Model instances.
Switch from manuel__ to sybil__ for checking examples in documentation. This introduces a backwards incompatible change in that ~testfixtures.sybil.Fi…
Switch from manuel to sybil for checking examples in documentation. This introduces a backwards incompatible change in that ~testfixtures.sybil.FileParser replaces the Manuel plugin that is no longer included.
Add a 'tick' method to test_datetime, test_date and test_time, to advance the returned point in time, which is particularly helpful when delta is set to zero.
Fix build environment bug in .travis.yml that caused bad tarballs.
Fix build environment bug in .travis.yml that caused bad tarballs.
New release as it looks like Travis mis-built the 4.14.1 tarball.
New release as it looks like Travis mis-built the 4.14.1 tarball.
- Fix mis-merge.
Fix mis-merge.
Added helpers for testing with django ~django.db.models.Model instances.
Added helpers for testing with django ~django.db.models.Model instances.
compare now correctly compares nested empty dictionaries when using ignore_eq=True.
compare now correctly compares nested empty dictionaries when using ignore_eq=True.
Keep the Reproducible Builds__ guys happy.
Keep the Reproducible Builds guys happy.
compare now better handles equality comparison with ignore_eq=True when either of the objects being compared cannot be hashed.
compare now better handles equality comparison with ignore_eq=True when either of the objects being compared cannot be hashed.
When ignore_eq is used with compare, fall back to comparing by hash if not type-specific comparer can be found.
When ignore_eq is used with compare, fall back to comparing by hash if not type-specific comparer can be found.
Add support to compare for ignoring broken __eq__ implementations.
Add support to compare for ignoring broken __eq__ implementations.
Add support for specifying a callable to extract rows from log records when using LogCapture.
Add support for specifying a callable to extract rows from log records when using LogCapture.
Add support for recursive comparison of log messages with LogCapture.
Allow the attributes returned in LogCapture.actual rows to be specified.
Allow the attributes returned in LogCapture.actual rows to be specified.
Allow a default to be specified for encoding in TempDirectory.read and TempDirectory.write.
Better docs for TempDirectory.compare.
Better docs for TempDirectory.compare.
Remove the need for expected paths supplied to TempDirectory.compare to be in sorted order.
Document a good way of restoring stdout when in a debugger.
Fix handling of trailing slashes in TempDirectory.compare.
Thanks to Maximilian Albert for the TempDirectory.compare docs.
Fixed examples in documentation broken in 4.5.1.
Fixed examples in documentation broken in 4.5.1.
Add RangeComparison for comparing against values that fall in a range.
Add ~popen.MockPopen.set_default to ~popen.MockPopen.
Thanks to Asaf Peleg for the RangeComparison implementation.
Fix for use with PyPy, broken since 4.8.0.
Fix for use with PyPy, broken since 4.8.0.
Thanks to Nicola Iarocci for the pull request to fix.
Added the suffix parameter to compare to allow failure messages to include some additional context.
Added the suffix parameter to compare to allow failure messages to include some additional context.
Update package metadata to indicate Python 3.5 compatibility.
Thanks for Felix Yan for the metadata patch.
Thanks to Wim Glenn for the suffix patch.
Introduce a new Replace context manager and make Replacer callable. This gives more succinct and easy to read mocking code.
Introduce a new Replace context manager and make Replacer callable. This gives more succinct and easy to read mocking code.
Add ShouldWarn and ShouldNotWarn context managers.
Add the ability to pass raises=False to compare to just get the resulting message back rather than having an exception raised.
Add the ability to pass raises=False to compare to just get the resulting message back rather than having an exception raised.
Fix a bug that mean symlinked directories would never show up when using TempDirectory.compare and friends.
Fix a bug that mean symlinked directories would never show up when using TempDirectory.compare and friends.
Add the followlinks parameter to TempDirectory.compare to indicate that symlinked or hard linked directories should be recursed into when using recursive=True.
Switch from cStringIO to StringIO in OutputCapture to better handle unicode being written to stdout or stderr.
Switch from cStringIO to StringIO in OutputCapture to better handle unicode being written to stdout or stderr.
Thanks to "tell-k" for the patch.
LogCapture, OutputCapture and TempDirectory now explicitly show what is expected versus actual when reporting differences.
LogCapture, OutputCapture and TempDirectory now explicitly show what is expected versus actual when reporting differences.
Thanks to Daniel Fortunov for the pull request.
Add support for labelling the arguments passed to compare.
Add support for labelling the arguments passed to compare.
Allow expected and actual keyword parameters to be passed to compare.
Fix TypeError: unorderable types when compare found multiple differences in sets and dictionaries on Python 3.
Add official support for Python 3.5.
Drop official support for Python 2.6.
Thanks to Daniel Fortunov for the initial ideas for explicit expected and actual support in compare.
Add wheel distribution to release.
Add wheel distribution to release.
Attempt to fix up various niggles from the move to Travis CI for doing releases.
- Fix broken 4.3.1 tag.
Fix broken 4.3.1 tag.
Deprecate TempDirectory.check, TempDirectory.check_dir and TempDirectory.check_all
Add TempDirectory.compare with a cleaner, more explicit API that allows comparison of only the files in a temporary directory.
Deprecate TempDirectory.check, TempDirectory.check_dir and TempDirectory.check_all
Relax absolute-path rules so that if it's inside the TempDirectory, it's allowed.
Allow OutputCapture to separately check output to stdout and stderr.
Add ~testfixtures.popen.MockPopen, a mock helpful when testing code that uses subprocess.Popen.
Add ~testfixtures.popen.MockPopen, a mock helpful when testing code that uses subprocess.Popen.
ShouldRaise now subclasses object, so that subclasses of it may use super().
Drop official support for Python 3.2.
Thanks to BATS Global Markets for donating the code for ~testfixtures.popen.MockPopen.
Clarify documentation for name parameter to LogCapture.
Clarify documentation for name parameter to LogCapture.
ShouldRaise now shows different output when two exceptions have the same representation but still differ.
Fix bug that could result in a dict comparing equal to a list.
Thanks to Daniel Fortunov for the documentation clarification.
Fix bug that prevented logger propagation to be controlled by the log_capture decorator.
Fix bug that prevented logger propagation to be controlled by the log_capture decorator.
Thanks to John Kristensen for the fix.
Fix compare bug when dict instances with tuple keys were not equal.
Fix compare bug when dict instances with tuple keys were not equal.
Allow logger propagation to be controlled by LogCapture.
Enabled disabled loggers if a LogCapture is attached to them.
Thanks to Daniel Fortunov for the compare fix.
Fix "maximum recursion depth exceeded" when comparing a string with bytes that did not contain the same character.
Fix "maximum recursion depth exceeded" when comparing a string with bytes that did not contain the same character.
Fix bugs when string compared equal and options to compare were used.
Fix bugs when string compared equal and options to compare were used.
Fix bug when strictly comparing two nested structures containing identical objects.
Moved from buildout to virtualenv for development.
Moved from buildout to virtualenv for development.
The identity singleton is no longer needed and has been removed.
compare will now work recursively on data structures for which it has registered comparers, giving more detailed feedback on nested data structures. Strict comparison will also be applied recursively.
Re-work the interfaces for using custom comparers with compare.
Better feedback when comparing collections.namedtuple instances.
Official support for Python 3.4.
Thanks to Yevgen Kovalienia for the typo fix in datetime.
Added RoundComparison helper for comparing numerics to a specific precision.
Added RoundComparison helper for comparing numerics to a specific precision.
Added unless parameter to ShouldRaise to cover some very specific edge cases.
Fix missing imports that showed up TempDirectory had to do the "convoluted folder delete" dance on Windows.
Thanks to Jon Thompson for the RoundComparison implementation.
Thanks to Matthias Lehmann for the import error reports.
Document ShouldRaise.raised and make it part of the official API.
Document ShouldRaise.raised and make it part of the official API.
Fix rare failures when cleaning up TempDirectory instances on Windows.
Some documentation tweaks and clarifications.
Some documentation tweaks and clarifications.
Fixed a bug which masked exceptions when using compare with a broken generator.
Fixed a bug when comparing a generator with a non-generator.
Ensure LogCapture cleans up global state it may effect.
Fixed replacement of static methods using a Replacer.
Added compatibility with Python 3.2 and 3.3.
Added compatibility with Python 3.2 and 3.3.
Dropped compatibility with Python 2.5.
Removed support for the following obscure uses of should_raise:
should_raise(x, IndexError)[1]
should_raise(x, KeyError)['x']
Dropped the mode parameter to TempDirectory.read.
TempDirectory.makedir and TempDirectory.write no longer accept a path parameter.
TempDirectory.read and TempDirectory.write now accept an encoding parameter to control how non-byte data is decoded and encoded respectively.
Added the prefix parameter to compare to allow failure messages to be made more informative.
Fixed a problem when using sub-second deltas with test_time.
Fixed a bug in ~testfixtures.comparers.compare_dict that mean the list of keys that were the same was returned in an unsorted order.
Fixed a bug in ~testfixtures.comparers.compare_dict that mean the list of keys that were the same was returned in an unsorted order.
Fixed compatibility with Python 2.5
Fixed compatibility with Python 2.5
Fixed compatibility with Python 2.7
Development model moved to continuous integration using Jenkins.
Introduced Tox based testing to ensure packaging and dependencies are as expected.
100% line and branch coverage with tests.
Mark test_datetime , test_date and test_time such that nose doesn't mistake them as tests.
Fixed a bug where when a target was replaced more than once using a single Replacer, ~Replacer.restore would not correctly restore the original.
Fixed a bug where when a target was replaced more than once using a single Replacer, ~Replacer.restore would not correctly restore the original.
Fixed a bug where attributes and keys could not be removed by a Replacer as described in removing_attr_and_item if the attribute or key might not be t
Fixed a bug where attributes and keys could not be removed by a Replacer as described in removing_attr_and_item if the attribute or key might not be there, such as where a test wants to ensure an os.environ variable is not set.
Move to use nose __ for running the testfixtures unit tests.
Move to use nose for running the testfixtures unit tests.
Fixed a bug where ~testfixtures.datetime.MockDateTime.now returned an instance of the wrong type when tzinfo was passed in strict mode.
Replacer, TempDirectory, LogCapture and TestComponents instances will now warn if the process they are created in exits without them being cleaned up.
Replacer, TempDirectory, LogCapture and TestComponents instances will now warn if the process they are created in exits without them being cleaned up. Instances of these classes should be cleaned up at the end of each test and these warnings serve to point to a cause for possible mysterious failures elsewhere.
Add a strict mode to test_datetime and test_date . When used, instances returned from the mocks are instances of those mocks. The default behaviour is
Add a strict mode to test_datetime and test_date. When used, instances returned from the mocks are instances of those mocks. The default behaviour is now to return instances of the real ~datetime.datetime and ~datetime.date classes instead, which is usually much more useful.
Add a strict mode to compare. When used, it ensures that the values compared are not only equal but also of the same type. This mode is not used by de
Add a strict mode to compare. When used, it ensures that the values compared are not only equal but also of the same type. This mode is not used by default, and the default mode restores the more commonly useful functionality where values of similar types but that aren't equal give useful feedback about differences.
add back functionality to allow comparison of generators with non-generators.
add back functionality to allow comparison of generators with non-generators.
compare now uses a registry of comparers that can be modified either by passing a registry option to compare or, globally, using the ~comparison.regis
compare now uses a registry of comparers that can be modified either by passing a registry option to compare or, globally, using the ~comparison.register function.
added a comparer for set instances to compare.
added a new show_whitespace parameter to ~comparers.compare_text, the comparer used when comparing strings and unicodes with compare.
The internal queue for test_datetime is now considered to be in local time. This has implication on the values returned from both ~testfixtures.datetime.MockDateTime.now and ~testfixtures.datetime.MockDateTime.utcnow when tzinfo is passed to the test_datetime constructor.
~testfixtures.datetime.MockDate.set and ~testfixtures.datetime.MockDate.add on test_date, test_datetime and test_time now accept instances of the appropriate type as an alternative to just passing in the parameters to create the instance.
Refactored the monolithic __init__.py into modules for each type of functionality.
Your coding agent can read these notes before it upgrades. Set up the MCP server →