summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/manifestparser
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /testing/mozbase/manifestparser
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/manifestparser')
-rw-r--r--testing/mozbase/manifestparser/manifestparser/toml.py8
-rwxr-xr-xtesting/mozbase/manifestparser/tests/test_manifestparser.py7
2 files changed, 14 insertions, 1 deletions
diff --git a/testing/mozbase/manifestparser/manifestparser/toml.py b/testing/mozbase/manifestparser/manifestparser/toml.py
index e028a4b0d7..4defd99156 100644
--- a/testing/mozbase/manifestparser/manifestparser/toml.py
+++ b/testing/mozbase/manifestparser/manifestparser/toml.py
@@ -163,8 +163,14 @@ def read_toml(
# merge combined defaults into each section
sections = [(i, combine_fields(defaults, j)) for i, j in sections]
- if not document:
+ if document:
+ # Take the line where the test name appears in the file.
+ for i, _ in enumerate(sections):
+ line = contents.split(sections[i][0])[0].count(os.linesep) + 1
+ manifest.setdefault(sections[i][0], {})["lineno"] = str(line)
+ else:
manifest = None
+
return sections, defaults, manifest
diff --git a/testing/mozbase/manifestparser/tests/test_manifestparser.py b/testing/mozbase/manifestparser/tests/test_manifestparser.py
index f1774cfffb..ddbc6ecc79 100755
--- a/testing/mozbase/manifestparser/tests/test_manifestparser.py
+++ b/testing/mozbase/manifestparser/tests/test_manifestparser.py
@@ -5,6 +5,7 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
+import re
import shutil
import tempfile
import unittest
@@ -620,6 +621,12 @@ yellow = submarine
after = "edit-manifest-after.toml"
after_path = os.path.join(here, after)
after_str = open(after_path, "r", encoding="utf-8").read()
+
+ # Define the regex pattern to match lines containing 'lineno'
+ pattern = re.compile(r"^.*lineno.*$\n?", re.MULTILINE)
+ # Remove lines containing 'lineno'
+ manifest_str = re.sub(pattern, "", manifest_str)
+
assert manifest_str == after_str