-
Notifications
You must be signed in to change notification settings - Fork 4
Testing
lachmanfrantisek edited this page Feb 9, 2019
·
6 revisions
- Library for very easy mocking of Python objects.
- 💻 github.com/bkabrda/flexmock, 📜 documentation
- , , 📦 fedora packages
- ➕
- Allows specifying multiple attributes and methods together. Example of
git.Repo
mock:
flexmock( active_branch="branch", working_dir="example/path", remote=lambda: flexmock(urls=["http://example/url"]), )
- Easy checking of calls, replacing of the method implementation:
flexmock() .should_receive("get_project") .with_args(repo="repo", namespace="namespace") .replace_with(lambda repo, namespace: flexmock()) .mock()
- Overwritting existing objects:
flexmock(git.Repo) .should_receive("remote") .replace_with(lambda: flexmock(urls=["http://example/url"])) .mock()
- Allows specifying multiple attributes and methods together. Example of
- ➖ :
- Mocking of the imports.