An open API service indexing awesome lists of open source software.

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)

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.