You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.
I found your project via: HypothesisWorks/hypothesis#377
I think it is easier to describe my question through an example :) .
Let assume following files.
conftest.py
defpytest_runtest_setup(item):
print("\nMessage from pytest setup, pytest item name: [%s]"%item.name)
test_example.py
fromhypothesisimportgiven, settingsfromhypothesis.strategiesimportintegers@settings(max_examples=2,)@given(integers())deftest_main(subtest, hypothesis_value):
print("\nMessage from main testcase, test value: [%s]"%hypothesis_value)
@subtestdeftest_concrete():
print("\nMessage from concrete testcase, test_value: [%s]"%hypothesis_value)
When I run my test it will produce the following STDOUT output:
...test_example.py::test_main Message from pytest setup, pytest item name: [test_main]Message from main testcase, test value: [0]Message from pytest setup, pytest item name: [test_main[]]Message from concrete testcase, test_value: [0]Message from main testcase, test value: [193]Message from pytest setup, pytest item name: [test_main[]]Message from concrete testcase, test_value: [193]
In my usecase I would like to run pytest hooks (or fixtures) only for "test_concrete" (or inner) like functions.
From pytest_runtest_setup "test_concrete" function is identified as "test_main" + "[]".
It means I should test (in pytest_runtest_setup) if my item.name contains: "[]" or not, which is not so informative.
My question:
Could we identify "test_concrete" (or inner) like functions better than: "my main function" + "[]"
Thank you very much
The text was updated successfully, but these errors were encountered:
mitzkia
changed the title
Identifing subtest from pytest fixture or pytest hooks
Identifing inner test functions from pytest fixture or pytest hooks
Oct 13, 2019
Hi,
I found your project via: HypothesisWorks/hypothesis#377
I think it is easier to describe my question through an example :) .
Let assume following files.
When I run my test it will produce the following STDOUT output:
In my usecase I would like to run pytest hooks (or fixtures) only for "test_concrete" (or inner) like functions.
From
pytest_runtest_setup
"test_concrete" function is identified as "test_main" + "[]".It means I should test (in
pytest_runtest_setup
) if my item.name contains: "[]" or not, which is not so informative.My question:
Could we identify "test_concrete" (or inner) like functions better than: "my main function" + "[]"
Thank you very much
The text was updated successfully, but these errors were encountered: