-
Notifications
You must be signed in to change notification settings - Fork 486
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
NAS-127251 / 24.10 / Add pytest markers for more intelligent runs #13041
base: master
Are you sure you want to change the base?
Conversation
f32f2a2
to
eaf74c3
Compare
This commit adds basic framework for setting custom markers in our API tests. They can either be set globally for the module via `pytestmark = pytest.mark.smb` and multiple for module `pytestmark = [pytest.mark.fs, pytest.mark.slow]` or via test-specific decorator `@pytest.mark.smb` Long-running tests (more than a couple of minutes) should be marked as `slow` so that they can be skipped in incremental builds.
25b2a4f
to
90ebf72
Compare
@@ -37,6 +37,7 @@ | |||
--interface <interface> - The interface that TrueNAS is run one | |||
|
|||
Optional option | |||
--markers "smb or nfs" - Markers to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not easy to indicate the format. Maybe
--markers "<markers to run>" - Quoted list separated by 'or', e.g. "smb or nfs". See pytest.ini for list of markers.
What would the runtest option look like if I wanted to run 'nfs' and tests without 'slow' markings only? |
@@ -2,6 +2,8 @@ | |||
|
|||
from middlewared.test.integration.assets.roles import common_checks | |||
|
|||
pytestmark = [pytest.mark.vm, pytest.mark.slow] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this slow?
Can we fail the whole test suite if some test file does not have any of the markers? |
@@ -123,6 +126,8 @@ | |||
callargs.append('-s') | |||
elif output == '--tests': | |||
tests.extend(arg.split(',')) | |||
elif output == '--markers': | |||
markers.extend(['-m', f'base or {arg}']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If arg
can be a logic expression shouldn't we enclose it in parenthesis?
This commit adds basic framework for setting custom markers in our API tests. They can either be set globally for the module via
pytestmark = pytest.mark.smb
and multiple for module
pytestmark = [pytest.mark.fs, pytest.mark.slow]
or via test-specific decorator
@pytest.mark.smb
Long-running tests (more than a couple of minutes) should be marked as
slow
so that they can be skipped in incremental builds.New markers can be added to the pytest.ini file. If someone feels particularly ambitious they can enhance in the future by adding a parser to assign markers based on test file names.