Comments (5)
Thanks @j-carson ! This is a very nice way indeed to fix this issue. However if results_bag
is not explicitly declared as a test dependency in your test function, request.getfixturevalue("results_bag")
might not work.
Therefore, I would suggest the following, I suspect that it works too:
@pytest.fixture
@one_fixture_per_step
def step_bag(results_bag):
return results_bag
Do you confirm ?
More generally I think that your proposal could make a great addition to pytest-steps
. However it should be optional: if this fixture is provided by the plugin, and the user does not use it in any of its tests, the user should not need pytest-harvest
to be installed. I think that with the above design, as long as "auto use" is not on, this is the pytest default behaviour. Do you confirm ?
from python-pytest-steps.
The shorter implementation of step_bag
fixture works for me.
I think that with the above design, as long as "auto use" is not on, this is the pytest default behaviour. Do you confirm ?
I will need to write a test case to verify this second question.
from python-pytest-steps.
Wrote the test case for above: In a virtualenv with pytest-steps installed but not pytest-harvest, the above fixture will not cause an error if that fixture is not used by any test.
from python-pytest-steps.
Cool ! Then it seems that all lights are green :)
Would you like to propose a PR then ?
The fixture would need to live in module plugin.py
and have at least one dedicated test. If you feel like updating the documentation markdown accordingly
-
api_reference.md : probably add a subsection under https://smarie.github.io/python-pytest-steps/api_reference/#pytest-harvest-utility-methods
-
index.md : probably add a subsection under https://smarie.github.io/python-pytest-steps/#3-usage-with-pytest-harvest)
(No need to test the case when the pytest-harvest plugin is not installed, this is a pytest mechanism and it wont change over time).
let me know !
from python-pytest-steps.
Fixed by #46
from python-pytest-steps.
Related Issues (20)
- `@cross_steps_fixture` does not wait for the last step to perform teardown
- `pytest_harvest` should not be mandatory for install
- Plugin fails to be detected when pytest-harvest is not present
- When calling a decorated test function manually, the test step list is not taken into account HOT 1
- If a step that is not the first is selected by a '-k' keyword selection in pytest, no error is raised and the wrong step is run
- pytest-steps is not compatible with async functions (pytest.mark.asyncio) HOT 4
- Protect against python 2 unicode literals
- Replace `@with_signature(new_sig)` with stub files (`*.pyi`)
- Python 3.8 incompatibility: DeprecationWarning: collections.abc HOT 1
- Improve packaging
- TypeError: test_suite() missing 2 required positional arguments: '________step_name_' and 'request' HOT 15
- TypeError: Unable to hash test parameter '...'. Hashable parameters are required to use steps reliably. HOT 1
- Pytest marks on generator test step? HOT 2
- order inverted HOT 3
- pandas deprecation warning in steps_pytest_harvest_utils.py HOT 7
- Migrate project template to new one using github actions
- 1.8.0: pytest is failing HOT 13
- received StopIteration if yield not present. yeah? but what should i do inside an exception block HOT 6
- yield <step-name> does not work without extra yield at the top of the test case HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-pytest-steps.