Hi Bruno,
This is great! Just echoing what Brian said - simple and obvious, and I'm
disappointed that I didn't see it myself. I've integrated your suggestion today
and the teardown tests are now much simpler, so this definitely helped.
Would it be worth PR-ing this suggestion into the docs? My
Hi Brian, James,
Glad you both found it useful!
> Would it be worth PR-ing this suggestion into the docs?
Sure, sounds great. While this is definitely useful for this use case, it
is also a good generic testing advice, so definitely has a place in
pytest's docs.
Cheers,
Bruno.
On Thu, Jan 7, 2
Hey,
On Wed, Jan 06, 2021 at 03:26:08PM -0300, Bruno Oliveira wrote:
> What I suggest you do in your case is to decouple your code from the
> fixture, so if you have something like this today:
>
> [setup / teardown in a fixture]
>
> You can write instead:
>
> @contextmanager
> def h
Hello,
I can recommend both Bruno's and Florian's approaches as being good
practice :)
Cheers,
Floris
On Thu 07 Jan 2021 at 18:11 +0100, Florian Bruhin wrote:
> Hey,
>
> On Wed, Jan 06, 2021 at 03:26:08PM -0300, Bruno Oliveira wrote:
>> What I suggest you do in your case is to decouple your cod