Though I didn't achieve the goal I had in mind, I did learn something.
So, I think I have found a workaround for my issue,
I was getting this from pytest:
> assert result.exception == KeyError()
E assert KeyError() == KeyError()
E + where KeyError() = <Result KeyError()>.exception
E + and KeyError() = KeyError()
tests/test_advanced.py:21: AssertionError
Though I didn't achieve the goal I had in mind, I did learn something. So, I think I have found a workaround for my issue, I was getting this from
pytest
:but now I changed the line a little bit:
and to give you some clarity:
but later I realised I am inside a bad pattern, I was catching and exception with
except
and raising it again withraise
.