Import upstream version 0.11.3+git20220528.1.c193779
Debian Janitor
1 year, 6 months ago
0 | include *.py | |
1 | include CHANGELOG.md | |
2 | include LICENSE | |
3 | include README.md | |
4 | recursive-include tests *py | |
5 | recursive-include docs *.md | |
6 | include docs/conf.py | |
7 | include docs/toctree.rst |
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: flexmock |
2 | 2 | Version: 0.11.3 |
3 | Summary: flexmock is a testing library for Python that makes it easy to create mocks, stubs and fakes. | |
4 | Home-page: https://github.com/flexmock/flexmock | |
3 | Summary: flexmock is a testing library for Python that makes it easy to create mocks,stubs and fakes. | |
4 | Home-page: https://flexmock.readthedocs.io/ | |
5 | Author: Slavek Kabrda, Herman Sheremetyev | |
6 | Author-email: slavek@redhat.com | |
5 | 7 | License: BSD-2-Clause |
6 | Keywords: mock,testing,test,unittest,pytest | |
7 | Author: Slavek Kabrda | |
8 | Maintainer: Adarsh Krishnan | |
9 | Maintainer-email: adarshk7@gmail.com | |
10 | Requires-Python: >=3.6.2,<4.0.0 | |
8 | Project-URL: Documentation, https://flexmock.readthedocs.io/ | |
9 | Project-URL: Changes, https://flexmock.readthedocs.io/en/latest/changelog/ | |
10 | Project-URL: Source Code, https://github.com/flexmock/flexmock | |
11 | Project-URL: Issue Tracker, https://github.com/flexmock/flexmock/issues | |
12 | Keywords: mock testing test unittest pytest | |
13 | Classifier: License :: OSI Approved :: BSD License | |
14 | Classifier: Intended Audience :: Developers | |
11 | 15 | Classifier: Development Status :: 5 - Production/Stable |
12 | Classifier: Intended Audience :: Developers | |
13 | Classifier: License :: OSI Approved :: BSD License | |
14 | 16 | Classifier: Programming Language :: Python :: 3 |
15 | Classifier: Programming Language :: Python :: 3 :: Only | |
16 | Classifier: Programming Language :: Python :: 3.10 | |
17 | Classifier: Programming Language :: Python :: 3.11 | |
18 | 17 | Classifier: Programming Language :: Python :: 3.6 |
19 | 18 | Classifier: Programming Language :: Python :: 3.7 |
20 | 19 | Classifier: Programming Language :: Python :: 3.8 |
21 | 20 | Classifier: Programming Language :: Python :: 3.9 |
21 | Classifier: Programming Language :: Python :: 3.10 | |
22 | Classifier: Programming Language :: Python :: 3.11 | |
23 | Classifier: Programming Language :: Python :: 3 :: Only | |
22 | 24 | Classifier: Programming Language :: Python :: Implementation :: PyPy |
23 | 25 | Classifier: Topic :: Software Development :: Testing |
24 | 26 | Classifier: Topic :: Software Development :: Testing :: Mocking |
25 | 27 | Classifier: Topic :: Software Development :: Testing :: Unit |
26 | 28 | Classifier: Typing :: Typed |
27 | Project-URL: Changes, https://flexmock.readthedocs.io/en/latest/changelog/ | |
28 | Project-URL: Documentation, https://flexmock.readthedocs.io | |
29 | Project-URL: Issue Tracker, https://github.com/flexmock/flexmock/issues | |
30 | Project-URL: Repository, https://github.com/flexmock/flexmock | |
31 | Project-URL: Source Code, https://github.com/flexmock/flexmock | |
29 | Requires-Python: >=3.6.2,<4.0.0 | |
32 | 30 | Description-Content-Type: text/markdown |
31 | License-File: LICENSE | |
33 | 32 | |
34 | 33 | <p align="center"> |
35 | 34 | <img alt="banner" src="https://user-images.githubusercontent.com/25169984/138661460-969caf9e-8e88-4609-87c4-1a0ab9624ee4.png"> |
126 | 125 | ## Contributing |
127 | 126 | |
128 | 127 | Contributions are absolutely welcome and encouraged! See [CONTRIBUTING.md](https://github.com/flexmock/flexmock/blob/master/CONTRIBUTING.md) to get started. |
129 |
94 | 94 | flexmock(plane).should_receive("fly").with_args("up").and_return("bad") |
95 | 95 | ``` |
96 | 96 | |
97 | Try to excecute `plane.fly()` with any, or no, arguments as defined by the first | |
97 | Try to execute `plane.fly()` with any, or no, arguments as defined by the first | |
98 | 98 | flexmock call will return the first value. |
99 | 99 | |
100 | 100 | ```python |
47 | 47 | "Issue Tracker" = "https://github.com/flexmock/flexmock/issues" |
48 | 48 | |
49 | 49 | [tool.poetry.dependencies] |
50 | python = "^3.6.2" | |
50 | python = "^3.6.7" | |
51 | 51 | |
52 | 52 | [tool.poetry.dev-dependencies] |
53 | 53 | pytest = "*" |
0 | # -*- coding: utf-8 -*- | |
0 | """Flexmock setup.py.""" | |
1 | 1 | from setuptools import setup |
2 | 2 | |
3 | package_dir = \ | |
4 | {'': 'src'} | |
3 | with open("README.md", "r", encoding="utf-8") as file: | |
4 | long_description = file.read() | |
5 | 5 | |
6 | packages = \ | |
7 | ['flexmock'] | |
6 | VERSION = "0.11.3" | |
8 | 7 | |
9 | package_data = \ | |
10 | {'': ['*']} | |
11 | ||
12 | setup_kwargs = { | |
13 | 'name': 'flexmock', | |
14 | 'version': '0.11.3', | |
15 | 'description': 'flexmock is a testing library for Python that makes it easy to create mocks, stubs and fakes.', | |
16 | 'long_description': '<p align="center">\n <img alt="banner" src="https://user-images.githubusercontent.com/25169984/138661460-969caf9e-8e88-4609-87c4-1a0ab9624ee4.png">\n</p>\n\n<p align="center"><strong>flexmock</strong> <em>- Mock, stub, and spy library for Python.</em></p>\n\n<p align="center">\n<a href="https://pypi.org/project/flexmock/">\n <img src="https://img.shields.io/pypi/v/flexmock" alt="pypi">\n</a>\n<a href="https://github.com/flexmock/flexmock/actions/workflows/ci.yml">\n <img src="https://github.com/flexmock/flexmock/actions/workflows/ci.yml/badge.svg" alt="ci">\n</a>\n<a href="https://flexmock.readthedocs.io/">\n <img src="https://img.shields.io/readthedocs/flexmock" alt="documentation">\n</a>\n<a href="https://codecov.io/gh/flexmock/flexmock">\n <img src="https://codecov.io/gh/flexmock/flexmock/branch/master/graph/badge.svg?token=wRgtiGxhiL" alt="codecov">\n</a>\n<a href="./LICENSE">\n <img src="https://img.shields.io/pypi/l/flexmock" alt="license">\n</a>\n</p>\n\n---\n\nFlexmock is a testing library for Python that makes it easy to create mocks, stubs, and fakes.\n\n## Features\n\n- **Mock**: Easily create mock objects and make assertions about which methods or attributes were used and arguments they were called with.\n- **Spy**: Proxy calls to object\'s original methods or attributes and make assertions based on return values or call count.\n- **Fake**: Generate a fake objects to be used in your tests with ease.\n- **Stub**: Create stub objects which replace parts of existing objects and classes with just one call.\n- **No external dependencies**: Flexmock is lightweight and only uses Python standard library. There are no external dependencies.\n- **Simple and intuitive**: Declarations are structured to read more like English sentences than API calls, so they are easy to learn and use.\n- **Fully type annotated**: External API is fully type annotated so it works great with static analysis tools and editor auto-completion.\n- **Integrations with test runners**: Integrates seamlessly with all major test runners like unittest, doctest, and pytest.\n- **Python 3.6+ and PyPy3**: Extensively tested to work with latest Python versions.\n\n## Installation\n\nInstall with pip:\n\n```\npip install flexmock\n```\n\n## Examples\n\nFlexmock features smooth integration with pretty much every popular test runner, so no special setup is necessary. Simply importing flexmock into your test module is sufficient to get started with any of the following examples:\n\n```python\nfrom flexmock import flexmock\n```\n\n### Mocks\n\nAssertions take many flavors and flexmock has many different facilities to generate them:\n\n```python\n# Simplest is ensuring that a certain method is called\nflexmock(Train).should_receive("get_tickets").once()\n\n# Of course, it is also possible to provide a default return value\nflexmock(Train).should_receive("get_destination").and_return("Paris").once()\n\n# Or check that a method is called with specific arguments\nflexmock(Train).should_receive("set_destination").with_args("Seoul").at_least().twice()\n```\n\n### Spies\n\nInstead of mocking, there are also times when you want to execute the actual method and simply find out how many times it was called. Flexmock uses `should_call` to generate this sort of assertions instead of `should_receive`:\n\n```python\n# Verify that a method is called at most three times\nflexmock(Train).should_call("get_tickets").at_most().times(3)\n\n# Make sure that a method is never called with specific arguments\nflexmock(Train).should_call("set_destination").with_args("Helsinki").never()\n\n# More complex example with features like argument type and exception matching\nflexmock(Train).should_call("crash").with_args(str, int).and_raise(AttributeError).once()\n```\n\nSee more examples in the documentation.\n\n## Documentation\n\nUser guide, examples, and a full API reference is available at: https://flexmock.readthedocs.io\n\n## Contributing\n\nContributions are absolutely welcome and encouraged! See [CONTRIBUTING.md](https://github.com/flexmock/flexmock/blob/master/CONTRIBUTING.md) to get started.\n', | |
17 | 'author': 'Slavek Kabrda', | |
18 | 'author_email': None, | |
19 | 'maintainer': 'Adarsh Krishnan', | |
20 | 'maintainer_email': 'adarshk7@gmail.com', | |
21 | 'url': 'https://github.com/flexmock/flexmock', | |
22 | 'package_dir': package_dir, | |
23 | 'packages': packages, | |
24 | 'package_data': package_data, | |
25 | 'python_requires': '>=3.6.2,<4.0.0', | |
26 | } | |
27 | ||
28 | ||
29 | setup(**setup_kwargs) | |
8 | setup( | |
9 | name="flexmock", | |
10 | version=VERSION, | |
11 | author="Slavek Kabrda, Herman Sheremetyev", | |
12 | author_email="slavek@redhat.com", | |
13 | url="https://flexmock.readthedocs.io/", | |
14 | project_urls={ | |
15 | "Documentation": "https://flexmock.readthedocs.io/", | |
16 | "Changes": "https://flexmock.readthedocs.io/en/latest/changelog/", | |
17 | "Source Code": "https://github.com/flexmock/flexmock", | |
18 | "Issue Tracker": "https://github.com/flexmock/flexmock/issues", | |
19 | }, | |
20 | license="BSD-2-Clause", | |
21 | description="flexmock is a testing library for Python that makes it easy to create mocks," | |
22 | "stubs and fakes.", | |
23 | long_description=long_description, | |
24 | long_description_content_type="text/markdown", | |
25 | keywords="mock testing test unittest pytest", | |
26 | classifiers=[ | |
27 | "License :: OSI Approved :: BSD License", | |
28 | "Intended Audience :: Developers", | |
29 | "Development Status :: 5 - Production/Stable", | |
30 | "Programming Language :: Python :: 3", | |
31 | "Programming Language :: Python :: 3.6", | |
32 | "Programming Language :: Python :: 3.7", | |
33 | "Programming Language :: Python :: 3.8", | |
34 | "Programming Language :: Python :: 3.9", | |
35 | "Programming Language :: Python :: 3.10", | |
36 | "Programming Language :: Python :: 3.11", | |
37 | "Programming Language :: Python :: 3 :: Only", | |
38 | "Programming Language :: Python :: Implementation :: PyPy", | |
39 | "Topic :: Software Development :: Testing", | |
40 | "Topic :: Software Development :: Testing :: Mocking", | |
41 | "Topic :: Software Development :: Testing :: Unit", | |
42 | "Typing :: Typed", | |
43 | ], | |
44 | python_requires=">=3.6.2,<4.0.0", | |
45 | packages=["flexmock"], | |
46 | package_dir={"": "src"}, | |
47 | include_package_data=True, | |
48 | command_options={ | |
49 | "build_sphinx": { | |
50 | "version": ("setup.py", VERSION), | |
51 | "release": ("setup.py", VERSION), | |
52 | } | |
53 | }, | |
54 | ) |
1267 | 1267 | return failed, message |
1268 | 1268 | |
1269 | 1269 | def _reset(self) -> None: |
1270 | """Returns the methods overriden by this expectation to their originals.""" | |
1270 | """Returns the methods overridden by this expectation to their originals.""" | |
1271 | 1271 | _mock = self._mock |
1272 | 1272 | if not isinstance(_mock, Mock): |
1273 | 1273 | original = self.__dict__.get("_original") |
0 | Metadata-Version: 2.1 | |
1 | Name: flexmock | |
2 | Version: 0.11.3 | |
3 | Summary: flexmock is a testing library for Python that makes it easy to create mocks,stubs and fakes. | |
4 | Home-page: https://flexmock.readthedocs.io/ | |
5 | Author: Slavek Kabrda, Herman Sheremetyev | |
6 | Author-email: slavek@redhat.com | |
7 | License: BSD-2-Clause | |
8 | Project-URL: Documentation, https://flexmock.readthedocs.io/ | |
9 | Project-URL: Changes, https://flexmock.readthedocs.io/en/latest/changelog/ | |
10 | Project-URL: Source Code, https://github.com/flexmock/flexmock | |
11 | Project-URL: Issue Tracker, https://github.com/flexmock/flexmock/issues | |
12 | Keywords: mock testing test unittest pytest | |
13 | Classifier: License :: OSI Approved :: BSD License | |
14 | Classifier: Intended Audience :: Developers | |
15 | Classifier: Development Status :: 5 - Production/Stable | |
16 | Classifier: Programming Language :: Python :: 3 | |
17 | Classifier: Programming Language :: Python :: 3.6 | |
18 | Classifier: Programming Language :: Python :: 3.7 | |
19 | Classifier: Programming Language :: Python :: 3.8 | |
20 | Classifier: Programming Language :: Python :: 3.9 | |
21 | Classifier: Programming Language :: Python :: 3.10 | |
22 | Classifier: Programming Language :: Python :: 3.11 | |
23 | Classifier: Programming Language :: Python :: 3 :: Only | |
24 | Classifier: Programming Language :: Python :: Implementation :: PyPy | |
25 | Classifier: Topic :: Software Development :: Testing | |
26 | Classifier: Topic :: Software Development :: Testing :: Mocking | |
27 | Classifier: Topic :: Software Development :: Testing :: Unit | |
28 | Classifier: Typing :: Typed | |
29 | Requires-Python: >=3.6.2,<4.0.0 | |
30 | Description-Content-Type: text/markdown | |
31 | License-File: LICENSE | |
32 | ||
33 | <p align="center"> | |
34 | <img alt="banner" src="https://user-images.githubusercontent.com/25169984/138661460-969caf9e-8e88-4609-87c4-1a0ab9624ee4.png"> | |
35 | </p> | |
36 | ||
37 | <p align="center"><strong>flexmock</strong> <em>- Mock, stub, and spy library for Python.</em></p> | |
38 | ||
39 | <p align="center"> | |
40 | <a href="https://pypi.org/project/flexmock/"> | |
41 | <img src="https://img.shields.io/pypi/v/flexmock" alt="pypi"> | |
42 | </a> | |
43 | <a href="https://github.com/flexmock/flexmock/actions/workflows/ci.yml"> | |
44 | <img src="https://github.com/flexmock/flexmock/actions/workflows/ci.yml/badge.svg" alt="ci"> | |
45 | </a> | |
46 | <a href="https://flexmock.readthedocs.io/"> | |
47 | <img src="https://img.shields.io/readthedocs/flexmock" alt="documentation"> | |
48 | </a> | |
49 | <a href="https://codecov.io/gh/flexmock/flexmock"> | |
50 | <img src="https://codecov.io/gh/flexmock/flexmock/branch/master/graph/badge.svg?token=wRgtiGxhiL" alt="codecov"> | |
51 | </a> | |
52 | <a href="./LICENSE"> | |
53 | <img src="https://img.shields.io/pypi/l/flexmock" alt="license"> | |
54 | </a> | |
55 | </p> | |
56 | ||
57 | --- | |
58 | ||
59 | Flexmock is a testing library for Python that makes it easy to create mocks, stubs, and fakes. | |
60 | ||
61 | ## Features | |
62 | ||
63 | - **Mock**: Easily create mock objects and make assertions about which methods or attributes were used and arguments they were called with. | |
64 | - **Spy**: Proxy calls to object's original methods or attributes and make assertions based on return values or call count. | |
65 | - **Fake**: Generate a fake objects to be used in your tests with ease. | |
66 | - **Stub**: Create stub objects which replace parts of existing objects and classes with just one call. | |
67 | - **No external dependencies**: Flexmock is lightweight and only uses Python standard library. There are no external dependencies. | |
68 | - **Simple and intuitive**: Declarations are structured to read more like English sentences than API calls, so they are easy to learn and use. | |
69 | - **Fully type annotated**: External API is fully type annotated so it works great with static analysis tools and editor auto-completion. | |
70 | - **Integrations with test runners**: Integrates seamlessly with all major test runners like unittest, doctest, and pytest. | |
71 | - **Python 3.6+ and PyPy3**: Extensively tested to work with latest Python versions. | |
72 | ||
73 | ## Installation | |
74 | ||
75 | Install with pip: | |
76 | ||
77 | ``` | |
78 | pip install flexmock | |
79 | ``` | |
80 | ||
81 | ## Examples | |
82 | ||
83 | Flexmock features smooth integration with pretty much every popular test runner, so no special setup is necessary. Simply importing flexmock into your test module is sufficient to get started with any of the following examples: | |
84 | ||
85 | ```python | |
86 | from flexmock import flexmock | |
87 | ``` | |
88 | ||
89 | ### Mocks | |
90 | ||
91 | Assertions take many flavors and flexmock has many different facilities to generate them: | |
92 | ||
93 | ```python | |
94 | # Simplest is ensuring that a certain method is called | |
95 | flexmock(Train).should_receive("get_tickets").once() | |
96 | ||
97 | # Of course, it is also possible to provide a default return value | |
98 | flexmock(Train).should_receive("get_destination").and_return("Paris").once() | |
99 | ||
100 | # Or check that a method is called with specific arguments | |
101 | flexmock(Train).should_receive("set_destination").with_args("Seoul").at_least().twice() | |
102 | ``` | |
103 | ||
104 | ### Spies | |
105 | ||
106 | Instead of mocking, there are also times when you want to execute the actual method and simply find out how many times it was called. Flexmock uses `should_call` to generate this sort of assertions instead of `should_receive`: | |
107 | ||
108 | ```python | |
109 | # Verify that a method is called at most three times | |
110 | flexmock(Train).should_call("get_tickets").at_most().times(3) | |
111 | ||
112 | # Make sure that a method is never called with specific arguments | |
113 | flexmock(Train).should_call("set_destination").with_args("Helsinki").never() | |
114 | ||
115 | # More complex example with features like argument type and exception matching | |
116 | flexmock(Train).should_call("crash").with_args(str, int).and_raise(AttributeError).once() | |
117 | ``` | |
118 | ||
119 | See more examples in the documentation. | |
120 | ||
121 | ## Documentation | |
122 | ||
123 | User guide, examples, and a full API reference is available at: https://flexmock.readthedocs.io | |
124 | ||
125 | ## Contributing | |
126 | ||
127 | Contributions are absolutely welcome and encouraged! See [CONTRIBUTING.md](https://github.com/flexmock/flexmock/blob/master/CONTRIBUTING.md) to get started. |
0 | CHANGELOG.md | |
1 | LICENSE | |
2 | MANIFEST.in | |
3 | README.md | |
4 | pyproject.toml | |
5 | setup.py | |
6 | docs/api.md | |
7 | docs/changelog.md | |
8 | docs/compare.md | |
9 | docs/conf.py | |
10 | docs/contributing.md | |
11 | docs/index.md | |
12 | docs/start.md | |
13 | docs/toctree.rst | |
14 | docs/advanced/builtin_functions.md | |
15 | docs/advanced/call_order.md | |
16 | docs/advanced/chained_methods.md | |
17 | docs/advanced/generators.md | |
18 | docs/advanced/multiple_return.md | |
19 | docs/advanced/new_instances.md | |
20 | docs/advanced/replacing_functions.md | |
21 | docs/advanced/state.md | |
22 | docs/usage/argument_matching.md | |
23 | docs/usage/call_count.md | |
24 | docs/usage/intro.md | |
25 | docs/usage/mocking.md | |
26 | docs/usage/spying.md | |
27 | src/flexmock/__init__.py | |
28 | src/flexmock/_api.py | |
29 | src/flexmock/_integrations.py | |
30 | src/flexmock/exceptions.py | |
31 | src/flexmock.egg-info/PKG-INFO | |
32 | src/flexmock.egg-info/SOURCES.txt | |
33 | src/flexmock.egg-info/dependency_links.txt | |
34 | src/flexmock.egg-info/top_level.txt | |
35 | tests/__init__.py | |
36 | tests/proxy.py | |
37 | tests/some_module.py | |
38 | tests/test_doctest.py | |
39 | tests/test_generic_integration.py | |
40 | tests/test_pytest.py | |
41 | tests/test_teamcity.py | |
42 | tests/test_testtools.py | |
43 | tests/test_unittest.py | |
44 | tests/utils.py | |
45 | tests/features/__init__.py | |
46 | tests/features/arg_matching.py | |
47 | tests/features/call_count.py | |
48 | tests/features/common.py | |
49 | tests/features/conditional.py | |
50 | tests/features/derived.py | |
51 | tests/features/mocking.py | |
52 | tests/features/ordered.py | |
53 | tests/features/proxied.py | |
54 | tests/features/spying.py | |
55 | tests/features/stubbing.py | |
56 | tests/features/teardown.py⏎ |
0 | flexmock |