Why does pytest use plain `assert` instead of `assertEqual`?
BeginnerConceptTesting, services & metrics
Answer
pytest rewrites assert statements at import time to show detailed introspection on failure: both sides of a comparison, the diff of dicts and lists, and intermediate values. So assert findings == expected gives a readable diff without needing the unittest method zoo. To check exceptions use with pytest.raises(ConfigError, match="missing region"):.
More on Testing, services & metrics
Why should automation scripts have tests at all?BeginnerHow does pytest discover and run tests?BeginnerWhat are pytest fixtures, and what scopes exist?IntermediateWhat built-in fixtures do you use most?IntermediateHow does `@pytest.mark.parametrize` work?BeginnerWhat is moto, and how do you use it with pytest?Intermediate