-
Notifications
You must be signed in to change notification settings - Fork 22
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
Is there a way to select which subtest to run? #100
Comments
Hi @BowenBao, This is not supported today, also I'm not sure how it could be made to work, given the user code that drives the subtests that are executed. |
@nicoddemus could you provide a little more context on this? I'm wondering if there's a way to pass an external value into a pytest test that would then control is the subtest is ran? My line of thought from your comment is that we could do something along the lines of:
I can't think of how we'd pass in |
This is outside of the scope of subtests |
@RonnyPfannschmidt Ok, could you at least point me in the right direction? It seems like by using subtests we're losing a valuable developer feature from pytest. |
Subtests are not tests, they are part of a test Nobody ever proposed/implemented a safe mechanism for selecting them and |
Ok, that still wasn't my question. My question was how do we pass external information to pytests. Do you happen to have a direction to suggest? |
@andre-qumulo depends on where the information comes from... do you mean from the command-line? Perhaps a concrete example of how you want to pass that information would be helpful. |
@nicoddemus my challenge is that I'm not familiar enough with how information is typically passed to unit tests outside of environment variables |
Sorry, I was not clear: I'm not asking you how you think it should be implemented, rather asking you how you would like to "use" this feature. For example you posted: if 'subtest1' in tests_to_run:
with self.subtest('subtest1'):
self.subtest_1() That's OK, but how do you, as a user, want that to pass that |
That's the part I'm unclear on personally. I don't see a clear way to pass in additional custom arguments via the pytest commandline: https://docs.pytest.org/en/6.2.x/usage.html#getting-help-on-version-option-names-environment-variables I am curious if you know of any ways. |
Like what
pytest -k <pattern>
does, but on subtest level.The text was updated successfully, but these errors were encountered: