-
Notifications
You must be signed in to change notification settings - Fork 7k
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
twister: Test suite name parsed as a test case if not using ZTest #81176
Comments
I was checking other harnesses, and I see for example that Pytest clears the test cases before running: zephyr/scripts/pylib/twister/twisterlib/harness.py Lines 544 to 546 in c50777a
In this case, we dont get the error because pytests clears any test case before running the tests. However, for harnesses that inherit from class I could do something hacky to cleary the testcases: class MyHarness(Harness):
def __init__(self):
self.started = False
def handle(self, line):
if not self.started:
self.instance.testcases = []
self.started = True But I think it would be better to not add a fake test case if the harnesss does not support parsing the source code or that the base class |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This is still a pending issue. |
@golowanow Can you please take a look at this and #74372. |
currently it is Twister behavior for non-Ztest Test Suites where it creates a 'standalone' default Test Case: zephyr/doc/develop/test/twister.rst Lines 283 to 294 in 176676d
In the new harness you should add test cases the similar way, as other harnesses, e.g. recently added #83297. Please rebase #74372 and let's resolve your problem there if it still remains. |
Thanks for the clarification. I will clear the list of |
Describe the bug
For harnesses that are not ZTest, the suite name declared in the yaml file is parsed as a test case.
Example:
In this example,
base.my_test_suite
, is parsed as a test case. This is wrong and will make twister complain when running the unit tests. Example:In this log, we can see that
test_1
was discovered while running the test. The first test case (i.e.,base.my_test_suite
is the suite name I defined in the yaml.To Reproduce
I am developing my own harness for cpputest, so this should allow to test it with an example:
Expected behavior
Test suite names from the
yaml
should not be considered as test cases. The relevant code is herezephyr/scripts/pylib/twister/twisterlib/testsuite.py
Lines 462 to 463 in c50777a
Impact
Harnesses that are not
ztest
will always create a fake testcase derived from the test-suite names. This erroneously adds a new testcase that does not exist.The text was updated successfully, but these errors were encountered: