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

weird setupstate behaviour for yield tests #16

Closed
pytestbot opened this issue Dec 29, 2010 · 12 comments
Closed

weird setupstate behaviour for yield tests #16

pytestbot opened this issue Dec 29, 2010 · 12 comments
Labels
type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Milestone

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt)


yield tests need a setupstate to be generated, however running the suite will destroy it when running a item with a new parent, then the setupstate will be recreated

this is what messes up the moin suite on pytest2.0
i still have to figure a reasonable minimized test


@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


To be more precise and make sure i understand: collecting yield-based tests needs setupstate and when further items are collected, the state may be teared down and thus when the yield-tests actually run, the setupstate needs to be recreated a second time. Right?

Now i wonder: why can the setup state not be created a second time?
And if that cannot happen, could the machinery be rewritten to use pytest_generate_tests?

feel free to also point me to the repo and exact code you are talking about.

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


ronny, what's the status of this issue and can you provide an exact example of what shoudl be fixed here?

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


im not sure what/how to fix, the problem is that yield tests need a setupstate in collection,
in the case of moint the generate a local wiki instance and prepare data
since the setupstate is removed when tests in a different hierachy run, the yielded closures break since the setup state changed

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


can you provide a minimal failing code example?

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


finally had a good idea for a minimal case

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


I assume, yield/setupstate is not an issue anymore, given that moinmoin now uses a more modern version.

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


its still an isse, moinmoin has a hack in place to work around

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


basically it will stay an issue till we provide a different way to have partial failures without stopping the complete test

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


I am not sure if we should pursue any improvements to yield-based tests. In any case, i don't know what the actual idea here is for improving yield-based setup. Doing larger scale refactorings just for better yield support does not seem worthwhile to me. It might be acceptable if better comes out as a side effect and the refactoring is useful for other reasons.

If nothing happens on this issue for a couple of months i'd like to close it.

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


i hit yet another proejct where this prevents pytest usage

the suggested solution is to drop collecting yield items, and make reporting prettier later

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


addresses #16 - replace Generator with pytest_pyfunc_interpret_result

@pytestbot pytestbot added the type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature label Jun 15, 2015
RonnyPfannschmidt referenced this issue in RonnyPfannschmidt/pytest Jul 12, 2015
however in order to do so yield tests are currently less detailed
but as bonus they now support fixtures like normal tests

the Generator object was completely removed and Function was aliased to Generatot
@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog labels Aug 26, 2015
@RonnyPfannschmidt RonnyPfannschmidt added this to the 3.0 milestone Sep 13, 2015
RonnyPfannschmidt referenced this issue in RonnyPfannschmidt/pytest Sep 27, 2015
however in order to do so yield tests are currently less detailed
but as bonus they now support fixtures like normal tests

the Generator object was completely removed and Function was aliased to Generatot
RonnyPfannschmidt referenced this issue in RonnyPfannschmidt/pytest Jan 3, 2016
nicoddemus referenced this issue in nicoddemus/pytest Jul 12, 2016
@RonnyPfannschmidt
Copy link
Member

finally addressed in #1714

fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
mgorny pushed a commit to mgorny/pytest that referenced this issue May 27, 2023
Add CircleCI configuration to run tests on Python 3 + fix several Python 3 issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: backward compatibility might present some backward compatibility issues which should be carefully noted in the changelog type: bug problem that needs to be addressed type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Projects
None yet
Development

No branches or pull requests

3 participants