Bug 1515890 [wpt PR 14625] - Make resources tests work better with positional arguments, a=testonly
authorjgraham <james@hoppipolla.co.uk>
Thu, 31 Jan 2019 12:14:10 +0000
changeset 457643 a3338f338d4082b62b4d83add8e00a8fd0c151fe
parent 457642 c61e1ff60a77e10b9e20029e28a9724234a33475
child 457644 1d07a9197385fd05cb29eecd4104c6392653ec0a
push id111763
push userjames@hoppipolla.co.uk
push dateThu, 07 Feb 2019 22:12:57 +0000
treeherdermozilla-inbound@c983e907bbfd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1515890, 14625
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515890 [wpt PR 14625] - Make resources tests work better with positional arguments, a=testonly Automatic update from web-platform-tests Make resources tests work better with positional arguments (#14625) Previously we did two slightly broken things; we applied the supplied arguments before the mandatory arguments, which prevented passing -- to seperate named arguments from positional arguments, and we depending on explictly passing in tests/ to avoid collecting HTML files in the resources/test/ directory as tests. To fix the latter we restrict the paths that can form tests in the collector rather than relying on specific command line arguments. -- wpt-commits: fb7d1eb9da882d1ca0d52737925a97dcc18aa96f wpt-pr: 14625
testing/web-platform/tests/resources/test/conftest.py
testing/web-platform/tests/resources/test/tox.ini
--- a/testing/web-platform/tests/resources/test/conftest.py
+++ b/testing/web-platform/tests/resources/test/conftest.py
@@ -22,17 +22,21 @@ def pytest_addoption(parser):
     parser.addoption("--binary", action="store", default=None, help="path to browser binary")
 
 
 def pytest_collect_file(path, parent):
     if path.ext.lower() != '.html':
         return
 
     # Tests are organized in directories by type
-    test_type = os.path.relpath(str(path), HERE).split(os.path.sep)[1]
+    test_type = os.path.relpath(str(path), HERE)
+    if os.path.sep not in test_type or ".." in test_type:
+        # HTML files in this directory are not tests
+        return
+    test_type = test_type.split(os.path.sep)[1]
 
     return HTMLItem(str(path), test_type, parent)
 
 
 def pytest_configure(config):
     config.driver = webdriver.Firefox(firefox_binary=config.getoption("--binary"))
     config.add_cleanup(config.driver.quit)
 
--- a/testing/web-platform/tests/resources/test/tox.ini
+++ b/testing/web-platform/tests/resources/test/tox.ini
@@ -9,9 +9,9 @@ passenv=DISPLAY # Necessary for the spaw
 deps =
   html5lib
   pytest>=2.9
   pyvirtualdisplay
   selenium
   six
   requests
 
-commands = pytest {posargs} -vv tests
+commands = pytest -vv {posargs}