[pytest-dev] Using a context manager in a funcarg/fixture

Brianna Laugher brianna.laugher at gmail.com
Tue Apr 23 09:46:09 CEST 2013


On 23 April 2013 17:39, holger krekel <holger at merlinux.eu> wrote:

> for clarification why i think this needs more discussion and playing
> around: what exactly should a fixturemanagers __exit__() see
> as exception value?  If we have multiple "contextmanager" fixtures like
> this:
>
>     def test_fixtures(fix1, fix2, fix3, ...):
>
> and fix2's setup fails, should fix1's __exit__ see that exception?
> Or should only exceptions from the actual test body be seen and then
> be seen by each fixN's __exit__ repeatedly?
>
> What about fixtures that have caching scopes higher than "function"?
> Should they ever receive exceptions in their __exit__?
>

Ah right... yes. I see how that is a problem.

Maybe then I need to refactor my context manager so it can used more easily
as a funcarg. :)

Brianna

-- 
They've just been waiting in a mountain for the right moment:
http://modernthings.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20130423/e1c66220/attachment.html>


More information about the Pytest-dev mailing list