Changes¶
8.3.0 (7 Jun 2024)¶
ShouldRaisenow supportsExceptionGroup.Fixed bug where
compare_generator()did not respectstrict=True.Fixed bug in the type annotations for
ShouldRaiseandcompare_exception().LogCapturewill now raise an exception if closed while still installed. This can be a source of particularly confusing bugs.
8.2.0 (1 May 2024)¶
The
strictoption is now correctly respected when comparing nested objects.When comparing
datetimeortimeinstances, if the fold is the only thing that’s different, it’s now shown in the output.A more detailed exception is now raised when resolving a replacement doesn’t give what’s expected.
Replacement of methods on instances is now prevented when
strict=True.An exception is now raised when mocking and the original is not in the
__dict__of its containing objects.
8.1.0 (1 Mar 2024)¶
Fix bug where replacement of methods on subclasses failed when using
Replacer.on_class().Implement strict comparison as an option for
datetimeandtime.
8.0.0 (16 Feb 2024)¶
Retire
zope.componenthelpers.Support
bytesinpopen.MockPopencommands.Allow
TempDirectoryinstances to be traversed asPathobjects.Use the system default encoding where possible in
TempDirectory.Add
TempDirectoryoption to manage current working directory.Allow string class attributes to be replaced with
Replacerand friends.Fix nasty bug meaning some
on_class()andin_module()replacements weren’t restored.Allow an alternative separator to be used for traversal during replacement with
Replacerand friends.Officially support Python 3.12.
Drop support Python 3.6.
7.2.2 (20 Oct 2023)¶
Fix bug in support for
os.PathLikearguments topopen.MockPopen.
7.2.1 (20 Oct 2023)¶
Added missing support for
os.PathLikearguments topopen.MockPopen.
7.2.0 (15 Sep 2023)¶
Add
order_mattersparameter toShouldWarn.
Thanks to Jan Musílek for the implementation!
7.1.0 (8 Feb 2023)¶
Implement new IDE and static-analysis ways of mocking including additional parameters to
replace()along with thereplace_on_class,replace_in_moduleandreplace_in_environcontext managers.
7.0.4 (5 Dec 2022)¶
Remove py.typed file: neither mypy nor testfixtures are ready for this file to be present.
7.0.3 (3 Nov 2022)¶
Further bugfixes around self-referential datastructures and
compare().
7.0.2 (1 Nov 2022)¶
Reinstate support for self-referential data structures in
compare(). The new implementation provides more clarity about what’s going on and also ignores more immutable data types.
7.0.1 (1 Nov 2022)¶
Remove non-functional support for self-referential data structures in
compare(). The functionality didn’t work but did cause erroneous reported equality of values in dictionaries that were actually not equal.
7.0.0 (6 Jul 2022)¶
Refresh documentation.
Add type annotations.
Drop support for Python 2. The minimum supported Python version is now 3.6.
Sybil 3 is now the minimum supported version if you use
FileParser.Rename and refactor the date and time mocks, they are now
mock_date,mock_datetimeandmock_time.test_date,test_datetimeandtest_timeare still present as aliases but are now deprecated.Add
TempDirectory.as_string(),TempDirectory.as_path()andTempDirectory.as_local.TempDirectory.getpath()is now deprecated.TempDirectorycan now be used to wrap existing directories.Fixed a bug where
OutputCapture.capturedreturned bytes instead of a string withfd=True.The deprecated
strictoption toComparisonhas been removed, use thepartialoption instead.The deprecated
TempDirectory.check,TempDirectory.check_dirandTempDirectory.check_allmethods have been removed.
6.18.5 (1 Mar 2022)¶
Fix bug in detection of Mock backport.
6.18.4 (25 Feb 2022)¶
Ensure compatibility with Sybil 2 and Sybil 3 along with pytest 6 and pytest 7.
6.18.3 (29 Sep 2021)¶
Fix bug when using
compare()on two regular expressions that have very long patterns.
Thanks to Christoph Ludwig for the report.
6.18.2 (21 Sep 2021)¶
Fix bug that meant
LogCapturedidn’t preserve or provide a clean testing environment for filters.
Thanks to Jesse Rittner for the fix.
6.18.1 (20 Aug 2021)¶
Fix bug when showing differences between mappings found by
compare()when mismatching values contained the same number more than once.
6.18.0 (15 Jul 2021)¶
Add support for lazy resolution of
prefixandsuffixwhen usingcompare().
6.17.1 (14 Jan 2020)¶
Fix bug where bug where duplicated entries in an ordered but partial
SequenceComparisoncould result in a failed match.
6.17.0 (16 Dec 2020)¶
Add simpler flag support to
StringComparison.Fix deprecation warning about invalid escape sequence.
Thanks to Wim Glenn for the deprecation warning fix.
6.16.0 (9 Dec 2020)¶
Simplify and clarify the documentation of timezones when using
test_datetime.API Reference has been re-arranged to make it easier to browse.
The
strictparameter toComparisonhas been deprecated in favour ofpartial.Add
SequenceComparison,SubsetandPermutationobjects.Add
MappingComparisonobjects.Officially support Python 3.9.
6.15.0 (9 Oct 2020)¶
Add support to
LogCapturefor making sure log entries above a specified level have been checked.
Thanks to Zoltan Farkas for the implementation.
6.14.2 (4 Sep 2020)¶
Fix bug where
ignore_eqhad no effect on nested objects when usingcompare().
Thanks to Grégoire Payen de La Garanderie for the fix.
6.14.1 (20 Apr 2020)¶
6.14.0 (24 Feb 2020)¶
Add support for non-deterministic logging order when using
twisted.LogCapture().
6.13.1 (20 Feb 2020)¶
Thanks to Daniel Fortunov for the fix.
6.13.0 (18 Feb 2020)¶
Allow any attributes that need to be ignored to be specified directly when calling
compare_object(). This is handy when writing comparers forcompare().
6.12.1 (16 Feb 2020)¶
6.12.0 (6 Feb 2020)¶
Add support for
universal_newlines,text,encodinganderrorstopopen.MockPopen, but only for Python 3.
6.11.0 (29 Jan 2020)¶
decimal.Decimalnow has better representation whencompare()displays a failed comparison, particularly on Python 2.Add support to
compare()for explicitly naming objects to be compared asxandy. This allows symmetry with thex_labelandy_labelparameters that are now documented.Restore ability for
Comparisonto compare properties and methods, although these uses are not recommended.
Thanks to Daniel Fortunov for all of the above.
6.10.3 (22 Nov 2019)¶
Fix bug where new-style classes had their attributes checked with
compare()even when they were of different types.
6.10.2 (15 Nov 2019)¶
Fix bugs in
compare()when comparing objects which have both__slots__and a__dict__.
6.10.1 (1 Nov 2019)¶
Fix edge case where string interning made dictionary comparison output much less useful.
6.10.0 (19 Jun 2019)¶
Better feedback where objects do not
compare()equal but do have the same representation.
6.9.0 (10 Jun 2019)¶
Fix deprecation warning relating to
getargspec.Improve mocking docs.
Added
strip_whitespaceoption toOutputCapture.When
separateis used withOutputCapture, differences instdoutandstderrare now given in the sameAssertionError.ShouldRaiseno longer catches exceptions that are not of the required type.Fixed a problem that resulted in unhelpful
compare()failures whencall()was involved and Python 3.6.7 was used.
Thanks to Łukasz Rogalski for the deprecation warning fix.
Thanks to Wim Glenn for the ShouldRaise idea.
6.8.2 (4 May 2019)¶
Fix handling of the latest releases of the
mockbackport.
6.8.1 (2 May 2019)¶
Fix bogus import in
OutputCapture.
6.8.0 (2 May 2019)¶
Allow
OutputCaptureto capture the underlying file descriptors forsys.stdoutandsys.stderr.
6.7.1 (29 Apr 2019)¶
Silence
DeprecationWarningrelating tocollections.abcon Python 3.7.
Thanks to Tom Hendrikx for the fix.
6.7.0 (11 Apr 2019)¶
Add
twisted.LogCapture.raise_logged_failure()debugging helper.
6.6.2 (22 Mar 2019)¶
popen.MockPopen.set_command()is now symmetrical withpopen.MockPopenprocess instantiation in that both can be called with either lists or strings, in the same way assubprocess.Popen.
6.6.1 (13 Mar 2019)¶
6.6.0 (22 Feb 2019)¶
Add the ability to ignore attributes of particular object types when using
compare().
6.5.2 (18 Feb 2019)¶
Fix bug when
compare()was used with objects that had__slots__inherited from a base class but where their__slots__was an empty sequence.
6.5.1 (18 Feb 2019)¶
Fix bug when
compare()was used with objects that had__slots__inherited from a base class.
6.5.0 (28 Jan 2019)¶
Experimental support for making assertions about events logged with Twisted’s logging framework.
6.4.3 (10 Jan 2019)¶
Fix problems on Python 2 when the rolling backport of mock was not installed.
6.4.2 (9 Jan 2019)¶
6.4.1 (24 Dec 2018)¶
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.
6.4.0 (19 Dec 2018)¶
Add official support for Python 3.7.
Drop official support for Python 3.5.
Introduce a facade for
unittest.mockattestfixtures.mock, including an important bug fix forcall()objects.Better feedback when
call()comparisons fail when usingcompare().A re-working of
MockPopento enable it to handle multiple processes being active at the same time.Fixes to Mocking dates and times documentation.
Thanks to Augusto Wagner Andreoli for his work on the Mocking dates and times documentation.
6.3.0 (4 Sep 2018)¶
Allow the behaviour specified with
set_command()to be a callable meaning that mock behaviour can now be dynamic based on the command executed and whatever was sent tostdin.Make
MockPopenmore accurately reflectsubprocess.Popenon Python 3 by addingtimeoutparameters towait()andcommunicate()along with some other smaller changes.
Thanks to Tim Davies for his work on MockPopen.
6.2.0 (14 Jun 2018)¶
6.1.0 (6 Jun 2018)¶
Support filtering for specific warnings with
ShouldWarn.
6.0.2 (2 May 2018)¶
Fix nasty bug where objects that had neither
__dict__nor__slots__would always be considered equal bycompare().
6.0.1 (17 April 2018)¶
6.0.0 (27 March 2018)¶
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 usingvars()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
stdinofMockPopeninstances.The default behaviour of
MockPopencan 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.Comparisonnow supports objects with__slots__.Added
ShouldAssertas 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
ShouldRaiseandComparisonto make use ofcompare()and so provide nested comparisons with better feedback. This finally allowsShouldRaiseto deal with Django’sValidationError.Added handling of self-referential structures to
compare()by treating all but the first occurence as equal. Another change needed to support Django’s insaneValidationError.
Thanks to Hamish Downer and Tim Davies for their work on MockPopen.
Thanks to Wim Glenn and Daniel Fortunov for their help reviewing some of the more major changes.
5.4.0 (25 January 2018)¶
5.3.1 (21 November 2017)¶
Fix missing support for the start_new_session parameter to
MockPopen.
5.3.0 (28 October 2017)¶
Add pytest traceback hiding for
TempDirectory.compare().Add warnings that
log_capture(),tempdir()andreplace()are not currently compatible with pytest’s fixtures mechanism.Better support for
stdoutorstderrnot being set toPIPEwhen usingMockPopen.Add support to
MockPopenfor usingsubprocess.Popenas a context manager in Python 3.Add support to
MockPopenforstderr=STDOUT.
Thanks to Tim Davies for his work on MockPopen.
5.2.0 (3 September 2017)¶
test_datetimeandtest_timenow accept adatetimeinstance during instantiation to set the initial value.test_datenow accepts adateinstance during instantiation to set the initial value.Relax the restriction on adding, setting or instantiating
test_datetimewith tzinfo such that if the tzinfo matches the one configured, then it’s okay to add. This means that you can now instantiate atest_datetimewith an existingdatetimeinstance that has tzinfo set.testfixtures.django.compare_model()now ignoresmany to manyfields rather than blowing up on them.Drop official support for Python 3.4, although things should continue to work.
5.1.1 (8 June 2017)¶
Fix support for Django 1.9 in
testfixtures.django.compare_model().
5.1.0 (8 June 2017)¶
5.0.0 (5 June 2017)¶
Switch from manuel to sybil for checking examples in documentation. This introduces a backwards incompatible change in that
FileParserreplaces the Manuel plugin that is no longer included.Add a ‘tick’ method to
test_datetime,test_dateandtest_time, to advance the returned point in time, which is particularly helpful whendeltais set to zero.
4.14.3 (15 May 2017)¶
Fix build environment bug in
.travis.ymlthat caused bad tarballs.
4.14.2 (15 May 2017)¶
New release as it looks like Travis mis-built the 4.14.1 tarball.
4.14.1 (15 May 2017)¶
Fix mis-merge.
4.14.0 (15 May 2017)¶
4.13.5 (1 March 2017)¶
compare()now correctly compares nested empty dictionaries when usingignore_eq=True.
4.13.4 (6 February 2017)¶
Keep the Reproducible Builds guys happy.
4.13.3 (13 December 2016)¶
compare()now better handles equality comparison withignore_eq=Truewhen either of the objects being compared cannot be hashed.
4.13.2 (16 November 2016)¶
Fixed a bug where a
LogCapturewouldn’t be cleared when used vialog_capture()on a base class and sub class execute the same test.
Thanks to “mlabonte” for the bug report.
4.13.1 (2 November 2016)¶
When
ignore_eqis used withcompare(), fall back to comparing by hash if not type-specific comparer can be found.
4.13.0 (2 November 2016)¶
Add support to
compare()for ignoring broken__eq__implementations.
4.12.0 (18 October 2016)¶
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.
4.11.0 (12 October 2016)¶
Allow the attributes returned in
LogCapture.actual()rows to be specified.Allow a default to be specified for encoding in
TempDirectory.read()andTempDirectory.write().
4.10.1 (5 September 2016)¶
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
stdoutwhen in a debugger.Fix handling of trailing slashes in
TempDirectory.compare().
Thanks to Maximilian Albert for the TempDirectory.compare() docs.
4.10.0 (17 May 2016)¶
Fixed examples in documentation broken in 4.5.1.
Add
RangeComparisonfor comparing against values that fall in a range.Add
set_default()toMockPopen.
Thanks to Asaf Peleg for the RangeComparison implementation.
4.9.1 (19 February 2016)¶
Fix for use with PyPy, broken since 4.8.0.
Thanks to Nicola Iarocci for the pull request to fix.
4.9.0 (18 February 2016)¶
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.
4.8.0 (2 February 2016)¶
Introduce a new
Replacecontext manager and makeReplacercallable. This gives more succinct and easy to read mocking code.Add
ShouldWarnandShouldNotWarncontext managers.
4.7.0 (10 December 2015)¶
Add the ability to pass
raises=Falsetocompare()to just get the resulting message back rather than having an exception raised.
4.6.0 (3 December 2015)¶
Fix a bug that mean symlinked directories would never show up when using
TempDirectory.compare()and friends.Add the
followlinksparameter toTempDirectory.compare()to indicate that symlinked or hard linked directories should be recursed into when usingrecursive=True.
4.5.1 (23 November 2015)¶
Switch from
cStringIOtoStringIOinOutputCaptureto better handle unicode being written to stdout or stderr.
Thanks to “tell-k” for the patch.
4.5.0 (13 November 2015)¶
LogCapture,OutputCaptureandTempDirectorynow explicitly show what is expected versus actual when reporting differences.
Thanks to Daniel Fortunov for the pull request.
4.4.0 (1 November 2015)¶
Add support for labelling the arguments passed to
compare().Allow
expectedandactualkeyword parameters to be passed tocompare().Fix
TypeError: unorderable typeswhencompare()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().
4.3.3 (15 September 2015)¶
Add wheel distribution to release.
Attempt to fix up various niggles from the move to Travis CI for doing releases.
4.3.2 (15 September 2015)¶
Fix broken 4.3.1 tag.
4.3.1 (15 September 2015)¶
Fix build problems introduced by moving the build process to Travis CI.
4.3.0 (15 September 2015)¶
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_dirandTempDirectory.check_allRelax absolute-path rules so that if it’s inside the
TempDirectory, it’s allowed.Allow
OutputCaptureto separately check output tostdoutandstderr.
4.2.0 (11 August 2015)¶
Add
MockPopen, a mock helpful when testing code that usessubprocess.Popen.ShouldRaisenow subclassesobject, so that subclasses of it may usesuper().Drop official support for Python 3.2.
Thanks to BATS Global Markets for donating the code for
MockPopen.
4.1.2 (30 January 2015)¶
Clarify documentation for
nameparameter toLogCapture.ShouldRaisenow shows different output when two exceptions have the same representation but still differ.Fix bug that could result in a
dictcomparing equal to alist.
Thanks to Daniel Fortunov for the documentation clarification.
4.1.1 (30 October 2014)¶
Fix bug that prevented logger propagation to be controlled by the
log_capturedecorator.
Thanks to John Kristensen for the fix.
4.1.0 (14 October 2014)¶
Fix
compare()bug whendictinstances withtuplekeys were not equal.Allow logger propagation to be controlled by
LogCapture.Enabled disabled loggers if a
LogCaptureis attached to them.
Thanks to Daniel Fortunov for the compare() fix.
4.0.2 (10 September 2014)¶
Fix “maximum recursion depth exceeded” when comparing a string with bytes that did not contain the same character.
4.0.1 (4 August 2014)¶
Fix bugs when string compared equal and options to
compare()were used.Fix bug when strictly comparing two nested structures containing identical objects.
4.0.0 (22 July 2014)¶
Moved from buildout to virtualenv for development.
The
identitysingleton 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 Mocking dates and times.
3.1.0 (25 May 2014)¶
Added
RoundComparisonhelper for comparing numerics to a specific precision.Added
unlessparameter toShouldRaiseto cover some very specific edge cases.Fix missing imports that showed up
TempDirectoryhad 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.
3.0.2 (7 April 2014)¶
Document
ShouldRaise.raisedand make it part of the official API.Fix rare failures when cleaning up
TempDirectoryinstances on Windows.
3.0.1 (10 June 2013)¶
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
LogCapturecleans up global state it may effect.Fixed replacement of static methods using a
Replacer.
3.0.0 (5 March 2013)¶
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()andTempDirectory.write()no longer accept a path parameter.TempDirectory.read()andTempDirectory.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.
2.3.5 (13 August 2012)¶
Fixed a bug in
compare_dict()that mean the list of keys that were the same was returned in an unsorted order.
2.3.4 (31 January 2012)¶
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_dateandtest_timesuch that nose doesn’t mistake them as tests.
2.3.3 (12 December 2011)¶
2.3.2 (10 November 2011)¶
Fixed a bug where attributes and keys could not be removed by a
Replaceras described in Removing attributes and dictionary items if the attribute or key might not be there, such as where a test wants to ensure anos.environvariable is not set.
2.3.1 (8 November 2011)¶
Move to use nose for running the testfixtures unit tests.
Fixed a bug where
now()returned an instance of the wrong type when tzinfo was passed in strict mode.
2.3.0 (11 October 2011)¶
Replacer,TempDirectory,LogCaptureandTestComponentsinstances 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.
2.2.0 (4 October 2011)¶
Add a strict mode to
test_datetimeandtest_date. When used, instances returned from the mocks are instances of those mocks. The default behaviour is now to return instances of the realdatetimeanddateclasses instead, which is usually much more useful.
2.1.0 (29 September 2011)¶
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.
2.0.1 (23 September 2011)¶
add back functionality to allow comparison of generators with non-generators.
2.0.0 (23 September 2011)¶
compare()now uses a registry of comparers that can be modified either by passing a registry option tocompare()or, globally, using theregister()function.added a new show_whitespace parameter to
compare_text(), the comparer used when comparing strings and unicodes withcompare().The internal queue for
test_datetimeis now considered to be in local time. This has implication on the values returned from bothnow()andutcnow()when tzinfo is passed to thetest_datetimeconstructor.set()andadd()ontest_date,test_datetimeandtest_timenow accept instances of the appropriate type as an alternative to just passing in the parameters to create the instance.Refactored the monolithic
__init__.pyinto modules for each type of functionality.
1.12.0 (16 August 2011)¶
Add a
capturedproperty toOutputCaptureso that more complex assertion can be made about the output that has been captured.OutputCapturecontext managers can now be temporarily disabled using theirdisable()method.Logging can now be captured only when it exceeds a specified logging level.
The handling of timezones has been reworked in both
test_datetimeandtest_time. This is not backwards compatible but is much more useful and correct.
1.11.3 (3 August 2011)¶
Fix bugs where various
test_date,test_datetimeandtest_timemethods didn’t accept keyword parameters.
1.11.2 (28 July 2011)¶
Fix for 1.10 and 1.11 releases that didn’t include non-.py files as a result of the move from subversion to git.
1.11.1 (28 July 2011)¶
Fix bug where
testfixtures.datetime.MockDateTime.now()didn’t accept the tz parameter thatdatetime.datetime.now()did.
1.11.0 (27 July 2011)¶
Give more useful output when comparing dicts and their subclasses.
Turn
should_raiseinto a decorator form ofShouldRaiserather than the rather out-moded wrapper function that it was.
1.10.0 (19 July 2011)¶
1.9.2 (20 April 2011)¶
Fix for issue #328:
utcnow()oftest_datetimenow returns items from the internal queue in the same way asnow().
1.9.1 (11 March 2011)¶
Fix bug when
ShouldRaisecontext managers incorrectly reported what exception was incorrectly raised when the incorrectly raised exception was aKeyError.
1.9.0 (11 February 2011)¶
Added
TestComponentsfor getting a sterile registry when testing code that useszope.component.
1.8.0 (14 January 2011)¶
Added full Sphinx-based documentation.
added a Manuel plugin for reading and writing files into a
TempDirectory.any existing log handlers present when a
LogCaptureis installed for a particular logger are now removed.fix the semantics of
should_raise, which should always expect an exception to be raised!added the
ShouldRaisecontext manager.added recursive support to
TempDirectory.listdir()and added the newTempDirectory.check_allmethod.added support for forward-slash separated paths to all relevant
TempDirectorymethods.added
TempDirectory.getpath()method.allow files and directories to be ignored by a regular expression specification when using
TempDirectory.made
Comparisonobjects work when the attributes expected might be class attributes.re-implement
test_timeso that it uses the correct way to get timezone-less time.added
set()along with delta and delta_type parameters totest_date,test_datetimeandtest_time.allow the date class returned by the
today()method to be configured.added the
OutputCapturecontext manager.added the
StringComparisonclass.added options to ignore trailing whitespace and blank lines when comparing multi-line strings with
compare().fixed bugs in the handling of some exception types when using
Comparison,ShouldRaiseorshould_raise.changed
wrap()to correctly set __name__, along with some other attributes, which should help when using the decorators with certain testing frameworks.
1.7.0 (20 January 2010)¶
fixed a bug where the @replace decorator passed a classmethod rather than the replacment to the decorated callable when replacing a classmethod
added set method to test_date, test_datetime and test_time to allow setting the parameters for the next instance to be returned.
added delta and delta_type parameters to test_date,test_datetime and test_time to control the intervals between returned instances.
1.6.2 (23 September 2009)¶
changed Comparison to use __eq__ and __ne__ instead of the deprecated __cmp__
documented that order matters when using Comparisons with objects that implement __eq__ themselves, such as instances of Django models.
1.6.1 (06 September 2009)¶
@replace and Replacer.replace can now replace attributes that may not be present, provided the strict parameter is passed as False.
should_raise now catches BaseException rather than Exception so raising of SystemExit and KeyboardInterrupt can be tested.
1.6.0 (09 May 2009)¶
added support for using TempDirectory, Replacer and LogCapture as context managers.
fixed test failure in Python 2.6.
1.5.4 (11 Feb 2009)¶
fix bug where should_raise didn’t complain when no exception was raised but one was expected.
clarified that the return of a should_raise call will be None in the event that an exception is raised but no expected exception is specified.
1.5.3 (17 Dec 2008)¶
should_raise now supports methods other than __call__
1.5.2 (14 Dec 2008)¶
added makedir and check_dir methods to TempDirectory and added support for sub directories to read and write
1.5.1 (12 Dec 2008)¶
added path parameter to write method of TempDirectory so that the full path of the file written can be easilly obtained
1.5.0 (12 Dec 2008)¶
added handy read and write methods to TempDirectory for creating and reading files in the temporary directory
added support for rich comparison of objects that don’t support vars()
1.4.0 (12 Dec 2008)¶
improved representation of failed Comparison
improved representation of failed compare with sequences
1.3.1 (10 Dec 2008)¶
fixed bug that occurs when directory was deleted by a test that use tempdir or TempDirectory
1.3.0 (9 Dec 2008)¶
added TempDirectory helper
added tempdir decorator
1.2.0 (3 Dec 2008)¶
LogCaptures now auto-install on creation unless configured otherwise
LogCaptures now have a clear method
LogCaptures now have a class method uninstall_all that uninstalls all instances of LogCapture. Handy for a tearDown method in doctests.
1.1.0 (3 Dec 2008)¶
add support to Comparisons for only comparing some attributes
move to use zope.dottedname
1.0.0 (26 Nov 2008)¶
Initial Release