File: migrating-0.9-to-1.0.rst

package info (click to toggle)
python-fudge 1.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 716 kB
  • sloc: javascript: 3,300; python: 2,537; makefile: 84; sh: 5
file content (20 lines) | stat: -rw-r--r-- 1,290 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

===============================
Migrating from Fudge 0.9 to 1.0
===============================

After :ref:`many 0.9.x versions <fudge-changelog>` and some great input from the community, Fudge has evolved to 1.0.  This introduces a much *simpler* API and while it doesn't deprecate the old API you'll probably want to update your code.

Take a look at the new code examples in :ref:`using Fudge <using-fudge>` to get a feel for it.

Here is a summary of changes:

The new @patch and @test decorators
===================================

You no longer have to worry about when and where to call :func:`fudge.clear_calls`, :func:`fudge.verify`, and :func:`fudge.clear_expectations`!  Instead, just wrap each test in the :func:`fudge.patch` decorator and declare expectations within your test.  If you don't need to patch anything, use the :func:`fudge.test` decorator.

Expectations that were declared in setup
========================================

If you were declaring expectations in a module-level ``setup()`` or ``unittest.setUp()`` method then you either have to continue managing the clear/verify calls manually and decorate your tests with :func:`fudge.with_fakes` or you need to move all declaration into the test function (not setup) using the :func:`fudge.patch` decorator.