0

I have installed a third party wheel file and I implemented/used one of the classes & exceptions(from wheel) into my piece of code. I wrote some unit-test cases for my piece of code. I am able to mock all the imports from wheel file apart from Exceptions. When I tried I am seeing following error :

TypeError: catching classes that do not inherit from BaseException is not allowed

Over Pycharm I overcome this scenario by installing wheel file and catching original exceptions instead of mocking them.

Whenever I tried to run the same class using coverage module (via terminal) I am seeing same exception again.

command I used to run this code:

python3 -m coverage -m unittest2 *.py

I am seeing the following error:

TypeError: catching classes that do not inherit from BaseException is not allowed

3
  • Did you use pip to install your third party wheel file like mentioned here: stackoverflow.com/a/28002930/15433312? Commented Apr 6, 2021 at 9:32
  • yes @Cheukting I have installed third party wheel using pip. I am able to validate it using 1. I am able to import classes & exceptions in python terminal. 2. I am able to validate using python -m <class name> Commented Apr 6, 2021 at 17:04
  • I ran each test python file individually then it worked. as shown below: python3 -m coverage -m unittest2 test_class_1.py test_class_2.py test_class_3.py Commented May 13, 2021 at 16:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.