Thin-wrapper around the mock package for easier use with pytest
Project Links
Meta
Author: Bruno Oliveira
Requires Python: >=3.9
Classifiers
Development Status
- 5 - Production/Stable
Framework
- Pytest
Intended Audience
- Developers
License
- OSI Approved :: MIT License
Operating System
- OS Independent
Programming Language
- Python :: 3
- Python :: 3 :: Only
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
Topic
- Software Development :: Testing
This plugin provides a mocker fixture which is a thin-wrapper around the patching API provided by the mock package:
import os
class UnixFS:
@staticmethod
def rm(filename):
os.remove(filename)
def test_unix_fs(mocker):
mocker.patch('os.remove')
UnixFS.rm('file')
os.remove.assert_called_once_with('file')
Besides undoing the mocking automatically after the end of the test, it also provides other nice utilities such as spy and stub, and uses pytest introspection when comparing calls.
Professionally supported pytest-mock is available.
Documentation
For full documentation, please see https://pytest-mock.readthedocs.io/en/latest.
License
Distributed under the terms of the MIT license.
Sep 16, 2025
3.15.1
Sep 04, 2025
3.15.0
May 26, 2025
3.14.1
Mar 21, 2024
3.14.0
Mar 21, 2024
3.13.0
Oct 19, 2023
3.12.0
Jun 15, 2023
3.11.1
Jun 15, 2023
3.11.0
Oct 05, 2022
3.10.0
Sep 28, 2022
3.9.0
Jul 05, 2022
3.8.2
Jun 24, 2022
3.8.1
Jun 24, 2022
3.8.0
Jan 28, 2022
3.7.0
May 06, 2021
3.6.1
Apr 24, 2021
3.6.0
Jan 10, 2021
3.5.1
Jan 04, 2021
3.5.0
Dec 15, 2020
3.4.0
Aug 26, 2020
3.3.1
Aug 22, 2020
3.3.0
Jul 11, 2020
3.2.0
Jun 04, 2020
3.1.1
Apr 18, 2020
3.1.0
Mar 31, 2020
3.0.0
Jan 04, 2020
2.0.0
Dec 06, 2019
1.13.0
Nov 20, 2019
1.12.1
Nov 19, 2019
1.12.0
Oct 23, 2019
1.11.2
Oct 04, 2019
1.11.1
Sep 28, 2019
1.11.0
Apr 17, 2019
1.10.4
Mar 30, 2019
1.10.3
Mar 25, 2019
1.10.2
Feb 04, 2019
1.10.1
May 01, 2018
1.10.0
Apr 10, 2018
1.9.0
Apr 07, 2018
1.8.0
Mar 01, 2018
1.7.1
Feb 16, 2018
1.7.0
Sep 15, 2017
1.6.3
Jul 17, 2017
1.6.2
Jul 17, 2017
1.6.1
Mar 30, 2017
1.6.0
Nov 22, 2016
1.5.0
Nov 03, 2016
1.4.0
Oct 29, 2016
1.3.0
Aug 02, 2016
1.2
Jun 01, 2016
1.1
May 19, 2016
1.0
Feb 23, 2016
0.11.0
Jan 27, 2016
0.10.1
Jan 27, 2016
0.10.0
Nov 18, 2015
0.9.0
Sep 29, 2015
0.8.1
Jul 07, 2015
0.7.0
Jun 02, 2015
0.6.0
May 03, 2015
0.5.0
Apr 09, 2015
0.4.3
Mar 31, 2015
0.4.2
Mar 15, 2015
0.4.1
Sep 17, 2014
0.4.0
Aug 26, 2014
0.3.0
Jul 18, 2014
0.2.0
Jul 17, 2014
0.1.0