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

Uday Kumar
  • 19
  • 3
  • Did you use `pip` to install your third party wheel file like mentioned here: https://stackoverflow.com/a/28002930/15433312? – Cheukting Apr 06 '21 at 09: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 – Uday Kumar Apr 06 '21 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 – Uday Kumar May 13 '21 at 16:42

0 Answers0