Title: [225447] trunk
Revision
225447
Author
[email protected]
Date
2017-12-02 06:56:26 -0800 (Sat, 02 Dec 2017)

Log Message

WebDriver: auto-install pytest instead of importing it from wpt tools directory
https://bugs.webkit.org/show_bug.cgi?id=180243

Reviewed by Brian Burg.

Tools:

We don't really need the (old) version included in wpt tools dir, so we can simply remove it and use autoinstall
instead.

* Scripts/webkitpy/thirdparty/__init__.py:
(AutoinstallImportHook.find_module): Check pytest.
(AutoinstallImportHook._install_pytest): Install pytest.
* Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py: Import autoinstalled pytest.
* Scripts/webkitpy/webdriver_tests/webdriver_test_runner_w3c.py:
(WebDriverTestRunnerW3C.run): Update the subtest path since the new pytest uses a different strategy for
rootdir.
* Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py: Import autoinstalled pytest.

WebDriverTests:

* imported/selenium/py/conftest.py: Stop patching this to use yield_fixture, new pytest supports this.
* imported/selenium/py/setup.cfg: Stop patching this, since pytest supports tool:pytest as group name.
* imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py: Stop patching this to use yield_fixture,
new pytest supports this.
* imported/selenium/py/test/selenium/webdriver/common/cookie_tests.py: Ditto.
* imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py: Ditto.
* imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py: Ditto.
* imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py: Ditto.
* imported/selenium/py/test/selenium/webdriver/safari/conftest.py: Ditto.
* imported/selenium/py/test/selenium/webdriver/support/event_firing_webdriver_tests.py: Ditto.
* imported/w3c/importer.json: Stop importing pytest.
* imported/w3c/pytest.ini: Added.
* imported/w3c/tools/pytest/: Removed.

Modified Paths

Added Paths

Removed Paths

  • trunk/WebDriverTests/imported/w3c/tools/pytest/

Diff

Modified: trunk/Tools/ChangeLog (225446 => 225447)


--- trunk/Tools/ChangeLog	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/Tools/ChangeLog	2017-12-02 14:56:26 UTC (rev 225447)
@@ -1,3 +1,22 @@
+2017-12-01  Carlos Garcia Campos  <[email protected]>
+
+        WebDriver: auto-install pytest instead of importing it from wpt tools directory
+        https://bugs.webkit.org/show_bug.cgi?id=180243
+
+        Reviewed by Brian Burg.
+
+        We don't really need the (old) version included in wpt tools dir, so we can simply remove it and use autoinstall
+        instead.
+
+        * Scripts/webkitpy/thirdparty/__init__.py:
+        (AutoinstallImportHook.find_module): Check pytest.
+        (AutoinstallImportHook._install_pytest): Install pytest.
+        * Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py: Import autoinstalled pytest.
+        * Scripts/webkitpy/webdriver_tests/webdriver_test_runner_w3c.py:
+        (WebDriverTestRunnerW3C.run): Update the subtest path since the new pytest uses a different strategy for
+        rootdir.
+        * Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py: Import autoinstalled pytest.
+
 2017-12-01  Dewei Zhu  <[email protected]>
 
         Hardcoded python path is not compatible with virtual environment.

Modified: trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py (225446 => 225447)


--- trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -112,6 +112,8 @@
             self._install_mozprocess()
         elif '.pytest_timeout' in fullname:
             self._install_pytest_timeout()
+        elif '.pytest' in fullname:
+            self._install_pytest()
 
     def _install_mechanize(self):
         self._install("https://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz",
@@ -139,6 +141,12 @@
         self._install("https://pypi.python.org/packages/cc/b7/b2a61365ea6b6d2e8881360ae7ed8dad0327ad2df89f2f0be4a02304deb2/pytest-timeout-1.2.0.tar.gz#md5=83607d91aa163562c7ee835da57d061d",
                               "pytest-timeout-1.2.0/pytest_timeout.py")
 
+    def _install_pytest(self):
+        self._install("https://pypi.python.org/packages/1f/f8/8cd74c16952163ce0db0bd95fdd8810cbf093c08be00e6e665ebf0dc3138/pytest-3.2.5.tar.gz#md5=6dbe9bb093883f75394a689a1426ac6f",
+                              "pytest-3.2.5/_pytest")
+        self._install("https://pypi.python.org/packages/1f/f8/8cd74c16952163ce0db0bd95fdd8810cbf093c08be00e6e665ebf0dc3138/pytest-3.2.5.tar.gz#md5=6dbe9bb093883f75394a689a1426ac6f",
+                              "pytest-3.2.5/pytest.py")
+
     def _install_pylint(self):
         self._ensure_autoinstalled_dir_is_in_sys_path()
         if (not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "pylint")) or

Modified: trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py (225446 => 225447)


--- trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_selenium_executor.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -27,6 +27,9 @@
 from webkitpy.common.system.filesystem import FileSystem
 from webkitpy.common.webkit_finder import WebKitFinder
 import webkitpy.thirdparty.autoinstalled.mozlog
+import webkitpy.thirdparty.autoinstalled.pytest
+import webkitpy.thirdparty.autoinstalled.pytest_timeout
+import pytest
 
 # Since W3C tests also use pytest, we use pytest and some other tools for selenium too.
 w3c_tools_dir = WebKitFinder(FileSystem()).path_from_webkit_base('WebDriverTests', 'imported', 'w3c', 'tools')
@@ -35,11 +38,8 @@
 def _ensure_directory_in_path(directory):
     if not directory in sys.path:
         sys.path.insert(0, directory)
-_ensure_directory_in_path(os.path.join(w3c_tools_dir, 'pytest'))
 _ensure_directory_in_path(os.path.join(w3c_tools_dir, 'wptrunner'))
 
-import pytest
-import webkitpy.thirdparty.autoinstalled.pytest_timeout
 from wptrunner.executors.pytestrunner.runner import HarnessResultRecorder, SubtestResultRecorder, TemporaryDirectory
 
 _log = logging.getLogger(__name__)

Modified: trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner_w3c.py (225446 => 225447)


--- trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner_w3c.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner_w3c.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -94,8 +94,8 @@
                 harness_result, test_results = executor.run(test)
                 result = WebDriverTestResult(test_name, *harness_result)
                 if harness_result[0] == 'OK':
-                    for test_result in test_results:
-                        result.add_subtest_results(*test_result)
+                    for subtest, status, message, backtrace in test_results:
+                        result.add_subtest_results(os.path.basename(subtest), status, message, backtrace)
                 else:
                     # FIXME: handle other results.
                     pass

Modified: trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py (225446 => 225447)


--- trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -28,6 +28,8 @@
 from webkitpy.common.webkit_finder import WebKitFinder
 import webkitpy.thirdparty.autoinstalled.mozlog
 import webkitpy.thirdparty.autoinstalled.mozprocess
+import webkitpy.thirdparty.autoinstalled.pytest
+import webkitpy.thirdparty.autoinstalled.pytest_timeout
 from mozlog import structuredlog
 
 w3c_tools_dir = WebKitFinder(FileSystem()).path_from_webkit_base('WebDriverTests', 'imported', 'w3c', 'tools')
@@ -36,11 +38,9 @@
 def _ensure_directory_in_path(directory):
     if not directory in sys.path:
         sys.path.insert(0, directory)
-_ensure_directory_in_path(os.path.join(w3c_tools_dir, 'pytest'))
 _ensure_directory_in_path(os.path.join(w3c_tools_dir, 'webdriver'))
 _ensure_directory_in_path(os.path.join(w3c_tools_dir, 'wptrunner'))
 
-import webkitpy.thirdparty.autoinstalled.pytest_timeout
 from wptrunner.executors.base import WdspecExecutor, WebDriverProtocol
 from wptrunner.webdriver_server import WebDriverServer
 

Modified: trunk/WebDriverTests/ChangeLog (225446 => 225447)


--- trunk/WebDriverTests/ChangeLog	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/ChangeLog	2017-12-02 14:56:26 UTC (rev 225447)
@@ -1,3 +1,24 @@
+2017-12-01  Carlos Garcia Campos  <[email protected]>
+
+        WebDriver: auto-install pytest instead of importing it from wpt tools directory
+        https://bugs.webkit.org/show_bug.cgi?id=180243
+
+        Reviewed by Brian Burg.
+
+        * imported/selenium/py/conftest.py: Stop patching this to use yield_fixture, new pytest supports this.
+        * imported/selenium/py/setup.cfg: Stop patching this, since pytest supports tool:pytest as group name.
+        * imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py: Stop patching this to use yield_fixture,
+        new pytest supports this.
+        * imported/selenium/py/test/selenium/webdriver/common/cookie_tests.py: Ditto.
+        * imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py: Ditto.
+        * imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py: Ditto.
+        * imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py: Ditto.
+        * imported/selenium/py/test/selenium/webdriver/safari/conftest.py: Ditto.
+        * imported/selenium/py/test/selenium/webdriver/support/event_firing_webdriver_tests.py: Ditto.
+        * imported/w3c/importer.json: Stop importing pytest.
+        * imported/w3c/pytest.ini: Added.
+        * imported/w3c/tools/pytest/: Removed.
+
 2017-11-30  Carlos Garcia Campos  <[email protected]>
 
         WebDriver: add support for importing and running selenium tests

Modified: trunk/WebDriverTests/imported/selenium/py/conftest.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/conftest.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/conftest.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -67,7 +67,7 @@
 driver_instance = None
 
 
[email protected]_fixture(scope='function')
[email protected](scope='function')
 def driver(request):
     kwargs = {}
 
@@ -157,7 +157,7 @@
     return Pages()
 
 
[email protected]_fixture(autouse=True, scope='session')
[email protected](autouse=True, scope='session')
 def server(request):
     drivers = request.config.getoption('drivers')
     if drivers is None or 'Remote' not in drivers:
@@ -196,7 +196,7 @@
         print('Selenium server has been terminated')
 
 
[email protected]_fixture(autouse=True, scope='session')
[email protected](autouse=True, scope='session')
 def webserver():
     webserver = SimpleWebServer(host=get_lan_ip())
     webserver.start()

Modified: trunk/WebDriverTests/imported/selenium/py/setup.cfg (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/setup.cfg	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/setup.cfg	2017-12-02 14:56:26 UTC (rev 225447)
@@ -5,7 +5,7 @@
 exclude = .tox,docs/source/conf.py
 ignore = E501
 
-[pytest]
+[tool:pytest]
 addopts = -r=a
 python_files = test_*.py *_tests.py
 testpaths = test

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/alerts_tests.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -29,7 +29,7 @@
     WebDriverException)
 
 
[email protected]_fixture(autouse=True)
[email protected](autouse=True)
 def close_alert(driver):
     yield
     try:

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/cookie_tests.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/cookie_tests.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/cookie_tests.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -33,7 +33,7 @@
     return cookie
 
 
[email protected]_fixture(autouse=True)
[email protected](autouse=True)
 def pages(request, driver, pages):
     pages.load('simpleTest.html')
     yield pages

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/frame_switching_tests.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -38,7 +38,7 @@
 # ----------------------------------------------------------------------------------------------
 
 
[email protected]_fixture(autouse=True)
[email protected](autouse=True)
 def restore_default_context(driver):
     yield
     driver.switch_to.default_content()

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/page_load_timeout_tests.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -20,7 +20,7 @@
 from selenium.common.exceptions import TimeoutException
 
 
[email protected]_fixture(autouse=True)
[email protected](autouse=True)
 def reset_timeouts(driver):
     yield
     driver.set_page_load_timeout(300)

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/common/window_switching_tests.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -24,7 +24,7 @@
 from selenium.webdriver.support.ui import WebDriverWait
 
 
[email protected]_fixture(autouse=True)
[email protected](autouse=True)
 def close_windows(driver):
     main_windows_handle = driver.current_window_handle
     yield

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/safari/conftest.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/safari/conftest.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/safari/conftest.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -30,7 +30,7 @@
     return {}
 
 
[email protected]_fixture
[email protected]
 def driver(driver_class, driver_kwargs):
     driver = driver_class(**driver_kwargs)
     yield driver

Modified: trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/support/event_firing_webdriver_tests.py (225446 => 225447)


--- trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/support/event_firing_webdriver_tests.py	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/selenium/py/test/selenium/webdriver/support/event_firing_webdriver_tests.py	2017-12-02 14:56:26 UTC (rev 225447)
@@ -28,7 +28,7 @@
 from selenium.webdriver.support.ui import WebDriverWait
 
 
[email protected]_fixture
[email protected]
 def log():
     log = BytesIO()
     yield log

Modified: trunk/WebDriverTests/imported/w3c/importer.json (225446 => 225447)


--- trunk/WebDriverTests/imported/w3c/importer.json	2017-12-02 08:47:19 UTC (rev 225446)
+++ trunk/WebDriverTests/imported/w3c/importer.json	2017-12-02 14:56:26 UTC (rev 225447)
@@ -2,7 +2,6 @@
     "repository": "https://github.com/w3c/web-platform-tests.git",
     "revision": "2b50389ee72d89dd0be12bc6ca54a6e95c98d163",
     "paths_to_import": [
-        "tools/pytest",
         "tools/webdriver",
         "tools/wptrunner",
         "webdriver"

Added: trunk/WebDriverTests/imported/w3c/pytest.ini (0 => 225447)


--- trunk/WebDriverTests/imported/w3c/pytest.ini	                        (rev 0)
+++ trunk/WebDriverTests/imported/w3c/pytest.ini	2017-12-02 14:56:26 UTC (rev 225447)
@@ -0,0 +1,2 @@
+# Pytest config file. We don't have any special configuration for pytest,
+# but the existance of this file here determines the rootdir used by pytest.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to