Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | GH-101100: Fix reference warnings for ``__enter__`` and ``__exit__`` (#110112) | Adam Turner | 2023-10-19 | 1 | -2/+2 |
| | |||||
* | GH-101100: Fix reference warnings for ``__getitem__`` (#110118) | Adam Turner | 2023-10-19 | 1 | -1/+1 |
| | |||||
* | gh-110631: Fix reST indentation in `Doc/library` (#110685) | Ezio Melotti | 2023-10-11 | 1 | -5/+5 |
| | | | Fix wrong indentation in the Doc/library dir. | ||||
* | Fix typos in docs and comments (#109619) | Heinz-Alexander Fuetterer | 2023-09-20 | 1 | -1/+1 |
| | |||||
* | gh-109350: Fix outdated captured output in unittest.mock documentation (#109353) | Egil Martinsson | 2023-09-15 | 1 | -4/+6 |
| | |||||
* | gh-106909: Use role :const: for referencing module constants (GH-106910) | Serhiy Storchaka | 2023-07-21 | 1 | -1/+1 |
| | |||||
* | gh-61215: Rename `wait_until_any_call` to `wait_until_any_call_with` (#106414) | Mario Corchero | 2023-07-04 | 1 | -2/+2 |
| | | | | | | mock: Rename `wait_until_any_call` to `wait_until_any_call_with` Rename the method to be more explicit that it expects the args and kwargs to wait for. | ||||
* | gh-61215: New mock to wait for multi-threaded events to happen (#16094) | Mario Corchero | 2023-07-03 | 1 | -0/+47 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mock: Add `ThreadingMock` class Add a new class that allows to wait for a call to happen by using `Event` objects. This mock class can be used to test and validate expectations of multithreading code. It uses two attributes for events to distinguish calls with any argument and calls with specific arguments. The calls with specific arguments need a lock to prevent two calls in parallel from creating the same event twice. The timeout is configured at class and constructor level to allow users to set a timeout, we considered passing it as an argument to the function but it could collide with a function parameter. Alternatively we also considered passing it as positional only but from an API caller perspective it was unclear what the first number meant on the function call, think `mock.wait_until_called(1, "arg1", "arg2")`, where 1 is the timeout. Lastly we also considered adding the new attributes to magic mock directly rather than having a custom mock class for multi threading scenarios, but we preferred to have specialised class that can be composed if necessary. Additionally, having added it to `MagicMock` directly would have resulted in `AsyncMock` having this logic, which would not work as expected, since when if user "waits" on a coroutine does not have the same meaning as waiting on a standard call. Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> | ||||
* | Add import of `unittest.mock.Mock` in documentation (#102346) | Wagner Alberto | 2023-03-03 | 1 | -0/+1 |
| | |||||
* | Correct trivial grammar in reset_mock docs (#101861) | Steve Kowalik | 2023-02-13 | 1 | -3/+3 |
| | |||||
* | gh-99087: Add missing newline for prompts in docs (GH-98993) | Stanley | 2022-12-09 | 1 | -0/+1 |
| | | | Add newline for prompts so copying to REPL does not cause errors. | ||||
* | gh-93851: Fix all broken links in Doc/ (GH-93853) | Oleg Iarygin | 2022-06-21 | 1 | -1/+1 |
| | |||||
* | gh-92417: `unittest.mock` docs: remove references to Python <2.6 (GH-92539) | Alex Waygood | 2022-05-10 | 1 | -1/+1 |
| | |||||
* | bpo-47235: Note where a typo is intentional in code. (GH-32348) | Gregory P. Smith | 2022-04-06 | 1 | -4/+4 |
| | | | | | | | | | | | People keep popping up reporting these as typos in the docs despite being described as typos in the surrounding text. Hopefully a comment on the line itself makes it more obvious? Arguably some of the typo examples are not using the "right" typo as the "assret" one in particular is now detected by default due to how common it was in actual code. But I don't want to to typo chasing by changing these examples to be other not yet auto-detected typos as they still illustrate the point well enough. | ||||
* | bpo-46852: Remove the float.__set_format__() method (GH-31585) | Victor Stinner | 2022-02-25 | 1 | -1/+1 |
| | | | | | | Remove the undocumented private float.__set_format__() method, previously known as float.__set_format__() in Python 3.7. Its docstring said: "You probably don't want to use this function. It exists mainly to be used in Python's test suite." | ||||
* | doc: fix a typo in unittest.mock.rst (GH-30227) | Joe | 2021-12-26 | 1 | -1/+1 |
| | |||||
* | bpo-45010: Remove support of special method __div__ in unittest.mock (GH-27965) | Serhiy Storchaka | 2021-08-26 | 1 | -1/+1 |
| | |||||
* | bpo-44679: [doc] fix typo in unittest.mock.rst (GH-27618) | Jack DeVries | 2021-08-05 | 1 | -1/+1 |
| | |||||
* | bpo-44534: fix wording and docstring sync in unittest.Mock GH27000 | Jack DeVries | 2021-07-05 | 1 | -1/+1 |
| | |||||
* | Remove duplicate words in docs. (GH-26167) | Mariusz Felisiak | 2021-05-21 | 1 | -2/+2 |
| | |||||
* | bpo-43400: Remove "easy to use" from mock docs (GH-24752) | Eddie Peters | 2021-03-04 | 1 | -1/+1 |
| | |||||
* | bpo-41877: Improve docs for assert misspellings check in mock (GH-23729) | vabr-g | 2020-12-10 | 1 | -3/+4 |
| | | | | | | | | | This is a follow-up to https://github.com/python/cpython/commit/4662fa9bfe4a849fe87bfb321d8ef0956c89a772. That original commit expanded guards against misspelling assertions on mocks. This follow-up updates the documentation and improves the error message by pointing out the potential cause and solution. Automerge-Triggered-By: GH:gpshead | ||||
* | bpo-41325: Add version note for args and kwargs property in call object ↵ | Jordan Speicher | 2020-07-18 | 1 | -0/+3 |
| | | | | (GH-21525) | ||||
* | Remove note saying patch is straightforward (#18431) | Brian Curtin | 2020-02-10 | 1 | -2/+1 |
| | | | | | | | While `unittest.mock.patch` is a great thing, it is not straightforward. If it were straightforward there wouldn't be such a huge amount of documentation for it, and frankly, when myself and others who I've read about often struggle to figure out what on earth `patch()` wants, coming to the docs to read that it's straightforward is not helpful. | ||||
* | bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521) | Paulo Henrique Silva | 2020-01-25 | 1 | -1/+2 |
| | |||||
* | Fix AsyncMock base class in the docs (GH-18008) | Elena Oat | 2020-01-15 | 1 | -1/+1 |
| | |||||
* | bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] ↵ | Jason Fried | 2019-11-21 | 1 | -1/+1 |
| | | | | (GH-17269) | ||||
* | bpo-38753: AsyncMock added in version 3.8 (GH-17102) | John Belmonte | 2019-11-20 | 1 | -0/+1 |
| | |||||
* | bpo-38738: Fix formatting of True and False. (GH-17083) | Serhiy Storchaka | 2019-11-12 | 1 | -17/+17 |
| | | | | | | | | | * "Return true/false" is replaced with "Return ``True``/``False``" if the function actually returns a bool. * Fixed formatting of some True and False literals (now in monospace). * Replaced "True/False" with "true/false" if it can be not only bool. * Replaced some 1/0 with True/False if it corresponds the code. * "Returns <bool>" is replaced with "Return <bool>". | ||||
* | bpo-38163: Child mocks detect their type as sync or async (GH-16471) | Lisa Roach | 2019-09-30 | 1 | -1/+27 |
| | |||||
* | bpo-38136: Updates await_count and call_count to be different things (GH-16192) | Lisa Roach | 2019-09-24 | 1 | -24/+13 |
| | |||||
* | bpo-35685: Add examples of unittest.mock.patch.dict usage (GH-11456) | Emmanuel Arias | 2019-09-12 | 1 | -4/+27 |
| | |||||
* | bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761) | Lisa Roach | 2019-09-09 | 1 | -0/+14 |
| | | | | | | | | | | * bpo-351428: Updates documentation to reflect AsyncMock call_count after await. * Adds skip and fixes warning. * Removes extra >>>. * Adds ... in front of await mock(). | ||||
* | docs: Add references to AsyncMock in unittest.mock.patch (#13681) | Mario Corchero | 2019-09-09 | 1 | -4/+16 |
| | | | | Update the docs as patch can now return an AsyncMock if the patched object is an async function. | ||||
* | bpo-35946: Improve assert_called_with documentation (GH-11796) | Rémi Lapeyre | 2019-08-29 | 1 | -2/+2 |
| | |||||
* | Fix docs for assert_called and assert_called_once (#15197) | Ismail S | 2019-08-12 | 1 | -2/+2 |
| | |||||
* | bpo-37075: Fix string concatenation in assert_has_awaits error message ↵ | Xtreak | 2019-05-29 | 1 | -1/+2 |
| | | | | | | | | | | (GH-13616) * Fix the implicit string concatenation in `assert_has_awaits` error message. * Use "await" instead of "call" in `assert_awaited_with` error message. https://bugs.python.org/issue37075 | ||||
* | bpo-32299: Return patched dict when using patch.dict as a context manager ↵ | Mario Corchero | 2019-05-28 | 1 | -1/+10 |
| | | | | | | (GH-11062) | ||||
* | bpo-37047: Refactor AsyncMock setup logic for autospeccing (GH-13574) | Xtreak | 2019-05-27 | 1 | -1/+5 |
| | | | | Handle late binding and attribute access in unittest.mock.AsyncMock setup for autospeccing. | ||||
* | Fix RuntimeWarning in unittest.mock asyncio example (GH-13449) | Xtreak | 2019-05-21 | 1 | -2/+2 |
| | | | | * This PR fixes the `RuntimeWarning` in `inspect.isawaitable(mock())` where `mock()` was not awaited. * Fix typo in asynctest project. | ||||
* | bpo-26467: Adds AsyncMock for asyncio Mock library support (GH-9296) | Lisa Roach | 2019-05-20 | 1 | -1/+214 |
| | |||||
* | bpo-21269: Provide args and kwargs attributes on mock call objects GH11807 | Kumar Akshay | 2019-03-22 | 1 | -8/+17 |
| | |||||
* | Fix typo in unittest.mock documentation: manger -> manager (GH-12352) | Joan Massich | 2019-03-17 | 1 | -1/+1 |
| | |||||
* | Add example to the documentation for calling unittest.mock.patch with ↵ | Pablo Galindo | 2019-01-09 | 1 | -7/+28 |
| | | | | create=True (GH-11056) | ||||
* | bpo-35226: Fix equality for nested unittest.mock.call objects. (#10555) | Chris Withers | 2018-12-03 | 1 | -0/+13 |
| | | | | Also refactor the call recording imolementation and add some notes about its limitations. | ||||
* | bpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960) | Max Bélanger | 2018-10-25 | 1 | -0/+4 |
| | | | | The MagicMock class supports many magic methods, but not __fspath__. To ease testing with modules such as os.path, this function is now supported by default. | ||||
* | unittest.mock doc: Fix references to recursive seal of Mocks (GH-9028) | Mario Corchero | 2018-10-19 | 1 | -4/+5 |
| | | | | | The docs in `library/unittest.mock` have been updated to remove confusing terms about submock and be explicit about the behavior expected. | ||||
* | bpo-34962: make doctest in Doc/ now passes, and is enforced in CI (GH-9806) | Stéphane Wirtel | 2018-10-12 | 1 | -32/+68 |
| | |||||
* | Fix "Python" casing in a few places (GH-9001) | Andrés Delfino | 2018-09-14 | 1 | -1/+1 |
| | |||||
* | bpo-32933: Implement __iter__ method on mock_open() (GH-5974) | Tony Flury | 2018-09-12 | 1 | -0/+4 |
| |