New issue 467: Cache fixtures which raise pytest.skip.Exception and 
pytest.fail.Exception
https://bitbucket.org/hpk42/pytest/issue/467/cache-fixtures-which-raise

Floris Bruynooghe:

Something I do quite a lot in fixtures is calling `pytest.skip(...)` or 
`pytest.fail(...)` in session-scoped fixtures, usually for a service like a 
database server which is not available.  However even though the fixture is 
scoped on the session py.test will not cache the exception raised from the 
fixture so the fixture will be executed again and again trying to connect to 
the same server over and over.

Currently I solve this by caching the skip result manually on the fixture so 
that the fixture code can skip early, but I think it would be nice if py.test 
cached the exceptions raised from the fixture.  While caching a generic 
exception might not be suitable I'm proposing to at least consider this for 
pytest.skip.Exception and pytest.fail.Exception.


_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to