Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Port package to Python 3.7 and Plone 5.2
# Mocking with mocker mock = self.mocker.mock() # mocker.Mock self.expect(mock.lock()).result('already locked') self.replay() self.assertEqual(mock.lock(), 'already locked')
# Mocking with unittest.mock mock = self.mock() # unittest.mock.Mock mock.lock.return_value = 'already locked' self.assertEqual(mock.lock(), 'already locked')
I've also replaced
There are various minor changes to make the code compatible with Python 3.
In general, I'm a bit reluctant with mocks and stubs in tests, because it has lead to an overuse once, where we've written a lot of very bad tests. So I'd prefer that most of the current mock tests are rewritten to integration tests anyway.
Since we need to change existing tests anyway with this change, I agree with your suggestion to keep the helper methods but go to