Skip to content

Commit dcdca82

Browse files
committed
do not use import alias for Test262 * in tests
1 parent 6b153c0 commit dcdca82

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

tools/serve/test_serve.py

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
from . import serve
1616
from .serve import (
1717
ConfigBuilder,
18+
Test262WindowHandler,
19+
Test262WindowTestHandler,
20+
Test262WindowModuleHandler,
21+
Test262WindowModuleTestHandler,
22+
Test262StrictWindowHandler,
23+
Test262StrictWindowTestHandler,
24+
Test262StrictHandler,
1825
WrapperHandler,
19-
inject_script,
20-
# Use 'T262' aliases to avoid naming collisions with the pytest collector
21-
Test262WindowHandler as T262WindowHandler,
22-
Test262WindowTestHandler as T262WindowTestHandler,
23-
Test262WindowModuleHandler as T262WindowModuleHandler,
24-
Test262WindowModuleTestHandler as T262WindowModuleTestHandler,
25-
Test262StrictWindowHandler as T262StrictWindowHandler,
26-
Test262StrictWindowTestHandler as T262StrictWindowTestHandler,
27-
Test262StrictHandler as T262StrictHandler)
26+
inject_script)
2827

2928

3029
logger = logging.getLogger()
@@ -270,14 +269,21 @@ def _test_handler_get_metadata(handler_cls: Type[WrapperHandler],
270269
assert item in metadata
271270
assert len(expected_metadata) == len(metadata), f"{expected_metadata} != {metadata}"
272271

272+
Test262WindowHandler.__test__ = False
273+
Test262WindowTestHandler.__test__ = False
274+
Test262WindowModuleHandler.__test__ = False
275+
Test262WindowModuleTestHandler.__test__ = False
276+
Test262StrictWindowHandler.__test__ = False
277+
Test262StrictWindowTestHandler.__test__ = False
278+
Test262StrictHandler.__test__ = False
273279

274280
@pytest.mark.parametrize("handler_cls, expected", [
275-
(T262WindowHandler, [(".test262.html", ".js", ".test262-test.html")]),
276-
(T262WindowTestHandler, [(".test262-test.html", ".js")]),
277-
(T262WindowModuleHandler, [(".test262-module.html", ".js", ".test262-module-test.html")]),
278-
(T262WindowModuleTestHandler, [(".test262-module-test.html", ".js")]),
279-
(T262StrictWindowHandler, [(".test262.strict.html", ".js", ".test262-test.strict.html")]),
280-
(T262StrictWindowTestHandler, [(".test262-test.strict.html", ".js", ".test262.strict.js")]),
281+
(Test262WindowHandler, [(".test262.html", ".js", ".test262-test.html")]),
282+
(Test262WindowTestHandler, [(".test262-test.html", ".js")]),
283+
(Test262WindowModuleHandler, [(".test262-module.html", ".js", ".test262-module-test.html")]),
284+
(Test262WindowModuleTestHandler, [(".test262-module-test.html", ".js")]),
285+
(Test262StrictWindowHandler, [(".test262.strict.html", ".js", ".test262-test.strict.html")]),
286+
(Test262StrictWindowTestHandler, [(".test262-test.strict.html", ".js", ".test262.strict.js")]),
281287
])
282288
def test_path_replace(test262_handlers, handler_cls, expected):
283289
tests_root, url_base = test262_handlers
@@ -286,17 +292,17 @@ def test_path_replace(test262_handlers, handler_cls, expected):
286292

287293
@pytest.mark.parametrize("handler_cls, request_path, expected_metadata", [
288294
(
289-
T262WindowTestHandler,
295+
Test262WindowTestHandler,
290296
"/test262/basic.test262-test.html",
291297
[('script', '/third_party/test262/harness/assert.js'), ('script', '/third_party/test262/harness/sta.js')]
292298
),
293299
(
294-
T262WindowTestHandler,
300+
Test262WindowTestHandler,
295301
"/test262/negative.test262-test.html",
296302
[('negative', 'TypeError')]
297303
),
298304
(
299-
T262StrictWindowTestHandler,
305+
Test262StrictWindowTestHandler,
300306
"/test262/teststrict.test262-test.strict.html",
301307
[('script', '/third_party/test262/harness/propertyHelper.js')]
302308
),
@@ -307,39 +313,39 @@ def test_get_metadata(test262_handlers, handler_cls, request_path, expected_meta
307313

308314

309315
@pytest.mark.parametrize("handler_cls, request_path, expected_substrings", [
310-
# T262WindowHandler: Should contain the iframe pointing to the test
316+
# Test262WindowHandler: Should contain the iframe pointing to the test
311317
(
312-
T262WindowHandler,
318+
Test262WindowHandler,
313319
"/test262/basic.test262.html",
314320
['<iframe id="test262-iframe" src="/test262/basic.test262-test.html"></iframe>']
315321
),
316-
# T262WindowTestHandler: Should contain script tags
322+
# Test262WindowTestHandler: Should contain script tags
317323
(
318-
T262WindowTestHandler,
324+
Test262WindowTestHandler,
319325
"/test262/basic.test262-test.html",
320326
['<script src="/test262/basic.js"></script>', '<script>test262Setup()</script>', '<script>test262Done()</script>']
321327
),
322-
# T262WindowModuleTestHandler: Should contain module import
328+
# Test262WindowModuleTestHandler: Should contain module import
323329
(
324-
T262WindowModuleTestHandler,
330+
Test262WindowModuleTestHandler,
325331
"/test262/module.test262-module-test.html",
326332
['<script type="module">', 'import {} from "/test262/module.js";', 'test262Setup();', 'test262Done();']
327333
),
328334
# Verification of the 'negative' replacement in the HTML
329335
(
330-
T262WindowTestHandler,
336+
Test262WindowTestHandler,
331337
"/test262/negative.test262-test.html",
332338
["<script>test262Negative('TypeError')</script>"]
333339
),
334340
# Strict HTML Case: points to the .strict.js variant
335341
(
336-
T262StrictWindowTestHandler,
342+
Test262StrictWindowTestHandler,
337343
"/test262/teststrict.test262-test.strict.html",
338344
['src="/test262/teststrict.test262.strict.js"']
339345
),
340346
# Strict JS Case: The handler that serves the actual script
341347
(
342-
T262StrictHandler,
348+
Test262StrictHandler,
343349
"/test262/teststrict.test262.strict.js",
344350
['"use strict";', "console.log('hello');"]
345351
),

0 commit comments

Comments
 (0)