Skip to content

Commit 766763e

Browse files
authored
Remove message argument from btest. NFC (#17503)
The `btest` method always has an expected result, which means that the message argument is always ignored. Perhaps this was different in the past but today the `run_browser` method either takes an expectation *or* a message.
1 parent 0706d4e commit 766763e

File tree

3 files changed

+85
-107
lines changed

3 files changed

+85
-107
lines changed

tests/common.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,15 +1488,16 @@ def assert_out_queue_empty(self, who):
14881488
# synchronously, so we have a timeout, which can be hit if the VM
14891489
# we run on stalls temporarily), so we let each test try more than
14901490
# once by default
1491-
def run_browser(self, html_file, message, expectedResult=None, timeout=None, extra_tries=1):
1491+
def run_browser(self, html_file, expected=None, message=None, timeout=None, extra_tries=1):
14921492
if not has_browser():
14931493
return
14941494
if BrowserCore.unresponsive_tests >= BrowserCore.MAX_UNRESPONSIVE_TESTS:
14951495
self.skipTest('too many unresponsive tests, skipping browser launch - check your setup!')
14961496
self.assert_out_queue_empty('previous test')
14971497
if DEBUG:
14981498
print('[browser launch:', html_file, ']')
1499-
if expectedResult is not None:
1499+
assert not (message and expected), 'run_browser expects `expected` or `message`, but not both'
1500+
if expected is not None:
15001501
try:
15011502
self.harness_in_queue.put((
15021503
'http://localhost:%s/%s' % (self.port, html_file),
@@ -1526,12 +1527,12 @@ def run_browser(self, html_file, message, expectedResult=None, timeout=None, ext
15261527
# verify the result, and try again if we should do so
15271528
output = unquote(output)
15281529
try:
1529-
self.assertContained(expectedResult, output)
1530+
self.assertContained(expected, output)
15301531
except Exception as e:
15311532
if extra_tries > 0:
15321533
print('[test error (see below), automatically retrying]')
15331534
print(e)
1534-
return self.run_browser(html_file, message, expectedResult, timeout, extra_tries - 1)
1535+
return self.run_browser(html_file, message, expected, timeout, extra_tries - 1)
15351536
else:
15361537
raise e
15371538
finally:
@@ -1693,7 +1694,7 @@ def btest_exit(self, filename, assert_returncode=0, *args, **kwargs):
16931694

16941695
def btest(self, filename, expected=None, reference=None,
16951696
reference_slack=0, manual_reference=None, post_build=None,
1696-
args=None, message='.', also_proxied=False,
1697+
args=None, also_proxied=False,
16971698
url_suffix='', timeout=None, also_wasm2js=False,
16981699
manually_trigger_reftest=False, extra_tries=1,
16991700
reporting=Reporting.FULL):
@@ -1729,13 +1730,13 @@ def btest(self, filename, expected=None, reference=None,
17291730
output = self.run_js('test.js')
17301731
self.assertContained('RESULT: ' + expected[0], output)
17311732
else:
1732-
self.run_browser(outfile + url_suffix, message, ['/report_result?' + e for e in expected], timeout=timeout, extra_tries=extra_tries)
1733+
self.run_browser(outfile + url_suffix, expected=['/report_result?' + e for e in expected], timeout=timeout, extra_tries=extra_tries)
17331734

17341735
# Tests can opt into being run under asmjs as well
17351736
if 'WASM=0' not in original_args and (also_wasm2js or self.also_wasm2js):
17361737
print('WASM=0')
17371738
self.btest(filename, expected, reference, reference_slack, manual_reference, post_build,
1738-
original_args + ['-sWASM=0'], message, also_proxied=False, timeout=timeout)
1739+
original_args + ['-sWASM=0'], also_proxied=False, timeout=timeout)
17391740

17401741
if also_proxied:
17411742
print('proxied...')
@@ -1746,7 +1747,7 @@ def btest(self, filename, expected=None, reference=None,
17461747
post_build = self.post_manual_reftest
17471748
# run proxied
17481749
self.btest(filename, expected, reference, reference_slack, manual_reference, post_build,
1749-
original_args + ['--proxy-to-worker', '-sGL_TESTING'], message, timeout=timeout)
1750+
original_args + ['--proxy-to-worker', '-sGL_TESTING'], timeout=timeout)
17501751

17511752

17521753
###################################################################################################

0 commit comments

Comments
 (0)