You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Moved tests/pymox to third_party/pymox Moved upload.py to third_party/upload.py Fixed tests so they can run standalone Fixed the executable bit on some scripts TEST=none BUG=34376 Review URL: http://codereview.chromium.org/562031 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@37987 0039d316-1c4b-4281-b951-d872f2087c98 |
15 years ago | |
---|---|---|
.. | ||
COPYING | 15 years ago | |
MANIFEST.in | 15 years ago | |
README | 15 years ago | |
__init__.py | 15 years ago | |
mox.py | 15 years ago | |
mox_test.py | 15 years ago | |
mox_test_helper.py | 15 years ago | |
setup.py | 15 years ago | |
stubout.py | 15 years ago | |
stubout_test.py | 15 years ago | |
stubout_testee.py | 15 years ago |
README
Mox is an open source mock object framework for Python, inspired by the Java library EasyMock. To install: $ python setup.py install To run Mox's internal tests: $ python mox_test.py Basic usage: import unittest import mox class PersonTest(mox.MoxTestBase): def testUsingMox(self): # Create a mock Person mock_person = self.mox.CreateMock(Person) test_person = ... test_primary_key = ... unknown_person = ... # Expect InsertPerson to be called with test_person; return # test_primary_key at that point mock_person.InsertPerson(test_person).AndReturn(test_primary_key) # Raise an exception when this is called mock_person.DeletePerson(unknown_person).AndRaise(UnknownPersonError()) # Switch from record mode to replay mode self.mox.ReplayAll() # Run the test ret_pk = mock_person.InsertPerson(test_person) self.assertEquals(test_primary_key, ret_pk) self.assertRaises(UnknownPersonError, mock_person, unknown_person) For more documentation, see: http://code.google.com/p/pymox/wiki/MoxDocumentation For more information, see: http://code.google.com/p/pymox/ Our user and developer discussion group is: http://groups.google.com/group/mox-discuss Mox is Copyright 2008 Google Inc, and licensed under the Apache License, Version 2.0; see the file COPYING for details. If you would like to help us improve Mox, join the group.