Bug 1640171 - Make the test file a str before using it. r=mozperftest-reviewers,tarek

This patch fixes a bug where a PosixPath is attempted to be used rather than a string path. There's also a regression in the coverage test run in `./mach perftest-test` on some platforms that is fixed by this patch (the attrs module being used by pytest is too old, so we update during setup). Lastly, a regression test is added to the browsertime tests to ensure that the command only contains knowingly compatible types.

Depends on D76713

Differential Revision: https://phabricator.services.mozilla.com/D76599
This commit is contained in:
Gregory Mierzwinski 2020-05-25 20:07:58 +00:00
Родитель 88c2ed6ab9
Коммит f94f60a9c2
4 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -46,7 +46,7 @@ class Options:
},
"--hooks": {
"type": str,
"default": "",
"default": None,
"help": "Script containing hooks. Can be a path or a URL.",
},
"--verbose": {"action": "store_true", "default": False, "help": "Verbose mode"},

Просмотреть файл

@ -45,7 +45,7 @@ class Perfherder(Layer):
"refbrow",
],
"help": "Shorthand name of application that is "
"being tested (used in perfherder data).",
"being tested (used in perfherder data).",
},
"metrics": {
"nargs": "*",

Просмотреть файл

@ -36,10 +36,15 @@ def test_browser(*mocked):
b(metadata)
finally:
shutil.rmtree(mach_cmd._mach_context.state_dir)
assert mach_cmd.run_process.call_count == 1
# XXX more checks
assert mach_cmd.run_process.call_args[0][-1][-1] == EXAMPLE_TEST
# Make sure all arguments are of type str
for option in mach_cmd.run_process.call_args[0][0]:
assert isinstance(option, str)
cmd = " ".join(mach_cmd.run_process.call_args[0][0])
assert "--firefox.geckodriverPath GECKODRIVER" in cmd

Просмотреть файл

@ -132,7 +132,7 @@ def build_test_list(tests, randomized=False):
test = Path(test)
if test.is_file():
res.append(test)
res.append(str(test))
elif test.is_dir():
for file in test.rglob("perftest_*.js"):
res.append(str(file))