https://github.com/pytest-with-eric/pytest-magicmock-raise-exception-example
How To Test Raised Exceptions with Pytest MagicMock? (Advanced Guide)
https://github.com/pytest-with-eric/pytest-magicmock-raise-exception-example
magicmock pytest-exception-handling pytest-mock pytest-raise-exception
Last synced: 3 months ago
JSON representation
How To Test Raised Exceptions with Pytest MagicMock? (Advanced Guide)
- Host: GitHub
- URL: https://github.com/pytest-with-eric/pytest-magicmock-raise-exception-example
- Owner: Pytest-with-Eric
- Created: 2023-10-13T06:26:36.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-12T08:02:52.000Z (about 1 year ago)
- Last Synced: 2025-01-29T12:29:40.131Z (5 months ago)
- Topics: magicmock, pytest-exception-handling, pytest-mock, pytest-raise-exception
- Language: Python
- Homepage: https://pytest-with-eric.com/pytest-best-practices/python-magicmock-raise-exception/
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyTest MagicMock Raise Exception Example
This repo contains the sample code for the article - [How To Test Raised Exceptions with Pytest MagicMock? (Advanced Guide)](https://pytest-with-eric.com/mocking/python-magicmock-raise-exception/)
This project explains how to test exceptions raised by Mocked Functions.
# Requirements
* Python (3.12)Please install the dependencies via the `requirements.txt` file using
```commandline
pip install -r requirements.txt
```
If you don't have Pip installed please follow instructions online on how to do it.# How To Run the Unit Tests
To run the Unit Tests, from the root of the repo run
```commandline
pytest -v -s
```If you have any questions about the project please raise an Issue on GitHub.