Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indirect fixtures #19

Closed
wants to merge 2 commits into from
Closed

Conversation

dburton90
Copy link

Hi, you asked me about some example for the issue I tried to resolve by the pull request from yestrday. So I added test to test_lazyfixture.py. It is basicly about indirect lazy_fixtures in test generator, which can do some modificition (in examle it is list modificition, but in real life it is usualy some db modificition etc...). If you run tests, the new test will fail on TypeError: 'LazyFixture' object does not support indexing. Beacause LazyFixture is never inicialized. If you uncommented lines 15-24 in pytest_lazyfixture.py, the test will pass.

@TvoroG
Copy link
Owner

TvoroG commented Nov 17, 2017

Hi, @dburton90! Thanks for the example and finding a bug. There was a problem with incorrect order of fixture initialization. I fixed it in issues19 branch. Can you please test it on your project and give some feedback if it works for you?

@dburton90
Copy link
Author

Hi thanks for changes the old test passed. But I found new test, where the error occurs again:
E TypeError: unsupported operand type(s) for +: 'int' and 'LazyFixture'

If I use pytest_fixture_setup hook it works. But I am actually not sure if this behaviour is supported by pytest or if this is just side-efect.

@TvoroG
Copy link
Owner

TvoroG commented Nov 28, 2017

Hi! Sorry for the late response :) I'll check it. Maybe there is a better solution for this problem.

@TvoroG
Copy link
Owner

TvoroG commented Nov 30, 2017

But I am actually not sure if this behaviour is supported by pytest or if this is just side-efect.

Yeah, me too :)

Anyway, I merged my changes to master and shipped it to pypi. For now I'll close it. Feel free to reopen if there will be more problems with the plugin :)

@TvoroG TvoroG closed this Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants