Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: tests/pymox/README

Issue 562031: Fix licensing headers and move most third party code to third_party/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 Mox is an open source mock object framework for Python, inspired by
2 the Java library EasyMock.
3
4 To install:
5
6 $ python setup.py install
7
8 To run Mox's internal tests:
9
10 $ python mox_test.py
11
12 Basic usage:
13
14 import unittest
15 import mox
16
17 class PersonTest(mox.MoxTestBase):
18
19 def testUsingMox(self):
20 # Create a mock Person
21 mock_person = self.mox.CreateMock(Person)
22
23 test_person = ...
24 test_primary_key = ...
25 unknown_person = ...
26
27 # Expect InsertPerson to be called with test_person; return
28 # test_primary_key at that point
29 mock_person.InsertPerson(test_person).AndReturn(test_primary_key)
30
31 # Raise an exception when this is called
32 mock_person.DeletePerson(unknown_person).AndRaise(UnknownPersonError())
33
34 # Switch from record mode to replay mode
35 self.mox.ReplayAll()
36
37 # Run the test
38 ret_pk = mock_person.InsertPerson(test_person)
39 self.assertEquals(test_primary_key, ret_pk)
40 self.assertRaises(UnknownPersonError, mock_person, unknown_person)
41
42 For more documentation, see:
43
44 http://code.google.com/p/pymox/wiki/MoxDocumentation
45
46 For more information, see:
47
48 http://code.google.com/p/pymox/
49
50 Our user and developer discussion group is:
51
52 http://groups.google.com/group/mox-discuss
53
54 Mox is Copyright 2008 Google Inc, and licensed under the Apache
55 License, Version 2.0; see the file COPYING for details. If you would
56 like to help us improve Mox, join the group.
OLDNEW
« tests/gclient_scm_test.py ('K') | « tests/pymox/MANIFEST.in ('k') | tests/pymox/mox.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698