-
Notifications
You must be signed in to change notification settings - Fork 20
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
Test Markers as Test Fields #141
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,3 +187,30 @@ def parse_docstring(docstring=None): | |
field_value = output | ||
fields_dict[field_name] = field_value | ||
return fields_dict | ||
|
||
|
||
def parse_markers(all_markers=None): | ||
"""Parse the markers.""" | ||
jyejare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ignore_list = ['parametrize', 'skipif', 'usefixtures', 'skip_if_not_set'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some of these seem to be My point here is - perhaps the It would make it much more flexible and easy to add more over time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
resolved_markers = [] | ||
|
||
def _process_marker(marker): | ||
# Fetching exact marker name | ||
marker_name = marker.split('mark.')[-1] if 'mark' in marker else marker | ||
jyejare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# ignoring the marker if in ignore list | ||
if not any(ignore_word in marker_name for ignore_word in ignore_list): | ||
resolved_markers.append(marker_name) | ||
|
||
for sec_marker in all_markers: | ||
# If the marker is none | ||
if not sec_marker: | ||
continue | ||
elif isinstance(sec_marker, list): | ||
for marker in sec_marker: | ||
_process_marker(marker) | ||
else: | ||
_process_marker(sec_marker) | ||
|
||
resolved_markers = ', '.join(resolved_markers) | ||
return resolved_markers | ||
jyejare marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Any particular reason that this is needed? I feel this should not be part of the PR since we are trying to introduce pytest markers support and not change how the docstring is parsed.
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.
@elyezer Not needed as part of PR, but the checks are not passing without this change due to flake8 rules! Also there is no harm in doing this change :)