pytest-with-eric / pytest-fixture-autouse-example Goto Github PK
View Code? Open in Web Editor NEWHow to Auto-Request Pytest Fixtures Using "Autouse"
Home Page: https://pytest-with-eric.com/pytest-advanced/pytest-fixture-autouse/
How to Auto-Request Pytest Fixtures Using "Autouse"
Home Page: https://pytest-with-eric.com/pytest-advanced/pytest-fixture-autouse/
Hi Eric :)
first off, congrats for maintaining such an amazing blog on pytest
features. I'm gradually going through all of the posts: they're great!
As for the autouse
internals, some doubts did arise. I'd like to ask you whether you could shed some light on the following:
at times (see test/test_number_conversions.py
or test/test_combining_autouse_with_normal.py
etc.) it seems that specifying autouse=True
is irrelevant as you would get the test passed as well by omitting it (as long as you pass the fixture to other fixtures or to test functions); said differently, it is not crystal clear (to me) where's the advantage in specifying autouse=True
in situations where not explicitly passing the fixture (to other fixtures or to test functions) would eventually lead to a failure
if I were to infer the meaning of autouse=True
before reading your post, I would have said that it would have helped eliminating the need for manual fixture invocation (which I would have read as the opportunity to avoid manually passing fixtures to test functions or other fixtures) in specific situations; as it doesn't seem to be the case, can you elaborate more on the rationale behind it? Not even the docs do make it clear (to me at least :))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.