Skip to content

Instantly share code, notes, and snippets.

@ta1hia
Created June 4, 2020 13:51
Show Gist options
  • Save ta1hia/065dc109c76b337bcd0fc665d5d77ba2 to your computer and use it in GitHub Desktop.
Save ta1hia/065dc109c76b337bcd0fc665d5d77ba2 to your computer and use it in GitHub Desktop.
Remove comment stripping and add comment field in "test-info report" mach cmd
diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py
--- a/testing/mozbase/manifestparser/manifestparser/ini.py
+++ b/testing/mozbase/manifestparser/manifestparser/ini.py
@@ -26,7 +26,8 @@ class IniParseError(Exception):
def read_ini(fp, defaults=None, default='DEFAULT', comments=None,
- separators=None, strict=True, handle_defaults=True):
+ separators=None, strict=True, handle_defaults=True,
+ show_inline_comments=False):
"""
read an .ini file and return a list of [(section, values)]
- fp : file pointer or path to read
@@ -79,6 +80,9 @@ def read_ini(fp, defaults=None, default=
inline_prefixes = next_prefixes
if comment_start != sys.maxsize:
+ if show_inline_comments:
+ current_comment = stripped[comment_start:].strip("#").strip()
+ current_section['comment'] = current_comment
stripped = stripped[:comment_start].rstrip()
# check for a new section
diff --git a/testing/mozbase/manifestparser/manifestparser/manifestparser.py b/testing/mozbase/manifestparser/manifestparser/manifestparser.py
--- a/testing/mozbase/manifestparser/manifestparser/manifestparser.py
+++ b/testing/mozbase/manifestparser/manifestparser/manifestparser.py
@@ -166,7 +166,8 @@ class ManifestParser(object):
# read the configuration
sections, defaults = read_ini(fp=fp, defaults=defaults, strict=self.strict,
- handle_defaults=self._handle_defaults)
+ handle_defaults=self._handle_defaults,
+ show_inline_comments=True)
if parentmanifest and filename:
# A manifest can be read multiple times, via "include:", optionally
# with section-specific variables. These variables only apply to
diff --git a/testing/testinfo.py b/testing/testinfo.py
--- a/testing/testinfo.py
+++ b/testing/testinfo.py
@@ -832,7 +832,7 @@ class TestInfoReport(TestInfo):
filter_values = filter_values.split(',')
else:
filter_values = []
- display_keys = (filter_keys or []) + ['skip-if', 'fail-if', 'fails-if']
+ display_keys = (filter_keys or []) + ['skip-if', 'fail-if', 'fails-if', 'comment']
display_keys = set(display_keys)
print("Finding tests...")
@@ -979,6 +979,7 @@ class TestInfoReport(TestInfo):
by_component['tests'][rkey] = [test_info]
if show_tests:
for key in by_component['tests']:
+
by_component['tests'][key].sort(key=lambda k: k['test'])
if show_activedata:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment