question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`request.addfinalizer` order of execution is undocumented

See original GitHub issue

This is very important if you are creating fixtures which interact with others which were not written with yield, and is extra confusing when writing tests which themselves do use yield.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nicoddemuscommented, Jun 7, 2022

Yeah, sounds great, thanks. I think just a paragraph stating that they are executed in first-in-last-out order is enough. 👍

0reactions
aizpurua23acommented, Jul 26, 2022

Hey eveyrone! I haven’t seen progress on this issue for some time, so I took the liberty to try and address it on https://github.com/pytest-dev/pytest/pull/10171.

I’d love to hear your thoughts on it 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pytest Finalizers - order of execution - Stack Overflow
I guess the easiest way would be to just try running your code with -s and see in which order the prints happen....
Read more >
pytest-django - Read the Docs
function requesting your fixture has this marker applied, depending on pytest's fixture execution order. To access.
Read more >
1.9.0 (2020-06-24) — py 1.9.1.dev3+g2da2cae documentation
fix issue35 - define __gt__ ordering between a local path and strings ... from request.addfinalizer() because request.cached_setup has the scope arg.
Read more >
All You Need To Know To Start Using Fixtures In Your Pytest ...
To define a teardown use the def fin(): ... + request.addfinalizer(fin) construct to do the required cleanup after each test. You can also...
Read more >
Changelog — pytest documentation
#9708: pytester now requests a monkeypatch fixture instead of creating one internally. ... #5196: Tests are now ordered by definition order in more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found