diff --git a/testing/web-platform/tests/.azure-pipelines.yml b/testing/web-platform/tests/.azure-pipelines.yml index 1c9883ccdec05..337d7e326ac92 100644 --- a/testing/web-platform/tests/.azure-pipelines.yml +++ b/testing/web-platform/tests/.azure-pipelines.yml @@ -117,24 +117,6 @@ jobs: displayName: 'Run tests (Safari Technology Preview)' - template: tools/ci/azure/publish_logs.yml -- job: tools_unittest_mac - displayName: 'tools/ unittests: macOS' - dependsOn: decision - condition: dependencies.decision.outputs['test_jobs.tools_unittest'] - pool: - vmImage: 'macOS-10.15' - variables: - HYPOTHESIS_PROFILE: ci - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7.x' - - template: tools/ci/azure/checkout.yml - - template: tools/ci/azure/tox_pytest.yml - parameters: - directory: tools/ - toxenv: py27 - - job: tools_unittest_mac_py36 displayName: 'tools/ unittests: macOS + Python 3.6' dependsOn: decision @@ -167,24 +149,6 @@ jobs: directory: tools/ toxenv: py38 -- job: wptrunner_unittest_mac - displayName: 'tools/wptrunner/ unittests: macOS' - dependsOn: decision - condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest'] - pool: - vmImage: 'macOS-10.15' - variables: - HYPOTHESIS_PROFILE: ci - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7.x' - - template: tools/ci/azure/checkout.yml - - template: tools/ci/azure/tox_pytest.yml - parameters: - directory: tools/wptrunner/ - toxenv: py27 - - job: wptrunner_unittest_mac_py36 displayName: 'tools/wptrunner/ unittests: macOS + Python 3.6' dependsOn: decision @@ -217,32 +181,6 @@ jobs: directory: tools/wptrunner/ toxenv: py38 -- job: wpt_integration_mac - displayName: 'tools/wpt/ tests: macOS' - dependsOn: decision - condition: dependencies.decision.outputs['test_jobs.wpt_integration'] - pool: - vmImage: 'macOS-10.15' - variables: - HYPOTHESIS_PROFILE: ci - steps: - # full checkout required - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7.x' - - template: tools/ci/azure/install_chrome.yml - - template: tools/ci/azure/install_firefox.yml - - template: tools/ci/azure/update_hosts.yml - parameters: - pyflag: --py2 - - template: tools/ci/azure/update_manifest.yml - parameters: - pyflag: --py2 - - template: tools/ci/azure/tox_pytest.yml - parameters: - directory: tools/wpt/ - toxenv: py27 - - job: wpt_integration_mac_py36 displayName: 'tools/wpt/ tests: macOS + Python 3.6' dependsOn: decision @@ -283,24 +221,6 @@ jobs: directory: tools/wpt/ toxenv: py38 -- job: tools_unittest_win - displayName: 'tools/ unittests: Windows' - dependsOn: decision - condition: dependencies.decision.outputs['test_jobs.tools_unittest'] - pool: - vmImage: 'windows-2019' - variables: - HYPOTHESIS_PROFILE: ci - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7.x' - - template: tools/ci/azure/checkout.yml - - template: tools/ci/azure/tox_pytest.yml - parameters: - directory: tools/ - toxenv: py27 - - job: tools_unittest_win_py36 displayName: 'tools/ unittests: Windows + Python 3.6' dependsOn: decision @@ -337,24 +257,6 @@ jobs: directory: tools/ toxenv: py38 -- job: wptrunner_unittest_win - displayName: 'tools/wptrunner/ unittests: Windows' - dependsOn: decision - condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest'] - pool: - vmImage: 'windows-2019' - variables: - HYPOTHESIS_PROFILE: ci - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7.x' - - template: tools/ci/azure/checkout.yml - - template: tools/ci/azure/tox_pytest.yml - parameters: - directory: tools/wptrunner/ - toxenv: py27 - - job: wptrunner_unittest_win_py36 displayName: 'tools/wptrunner/ unittests: Windows + Python 3.6' dependsOn: decision @@ -389,34 +291,6 @@ jobs: directory: tools/wptrunner/ toxenv: py38 -- job: wpt_integration_win - displayName: 'tools/wpt/ tests: Windows' - dependsOn: decision - condition: dependencies.decision.outputs['test_jobs.wpt_integration'] - pool: - vmImage: 'windows-2019' - variables: - HYPOTHESIS_PROFILE: ci - steps: - # full checkout required - - task: UsePythonVersion@0 - inputs: - versionSpec: '2.7.x' - # currently just using the outdated Chrome/Firefox on the VM rather than - # figuring out how to install Chrome Dev channel on Windows - # - template: tools/ci/azure/install_chrome.yml - # - template: tools/ci/azure/install_firefox.yml - - template: tools/ci/azure/update_hosts.yml - parameters: - pyflag: --py2 - - template: tools/ci/azure/update_manifest.yml - parameters: - pyflag: --py2 - - template: tools/ci/azure/tox_pytest.yml - parameters: - directory: tools/wpt/ - toxenv: py27 - - job: wpt_integration_win_py36 displayName: 'tools/wpt/ tests: Windows + Python 3.6' dependsOn: decision diff --git a/testing/web-platform/tests/docs/running-tests/from-local-system.md b/testing/web-platform/tests/docs/running-tests/from-local-system.md index f5cfa36915d78..53f6a1fb98d58 100644 --- a/testing/web-platform/tests/docs/running-tests/from-local-system.md +++ b/testing/web-platform/tests/docs/running-tests/from-local-system.md @@ -7,8 +7,7 @@ The tests are designed to be run from your local computer. Running the tests requires `python`, `pip` and `virtualenv`, as well as updating the system `hosts` file. -Python 3 is supported and preferred, but for now it is still possible to use -Python 2.7 if necessary. +WPT requires Python 3.6 or higher. The required setup is different depending on your operating system. @@ -45,10 +44,10 @@ See also [additional setup required to run Safari](safari.md). ### Windows Setup -Download and install [Python 2.7](https://www.python.org/downloads). The +Download and install [Python 3](https://www.python.org/downloads). The installer includes `pip` by default. -Add `C:\Python27` and `C:\Python27\Scripts` to your `%Path%` +Add `C:\Python39` and `C:\Python39\Scripts` to your `%Path%` [environment variable](http://www.computerhope.com/issues/ch000549.htm). Finally, install `virtualenv`: diff --git a/testing/web-platform/tests/docs/writing-tests/h2tests.md b/testing/web-platform/tests/docs/writing-tests/h2tests.md index c13295e1fe668..9a429373f5672 100644 --- a/testing/web-platform/tests/docs/writing-tests/h2tests.md +++ b/testing/web-platform/tests/docs/writing-tests/h2tests.md @@ -1,7 +1,7 @@ # Writing H2 Tests -> Important: The HTTP/2.0 server requires you to have Python 2.7.10+ -and OpenSSL 1.0.2+. This is because HTTP/2.0 is negotiated using the +> Important: The HTTP/2.0 server requires you to have +OpenSSL 1.0.2+. This is because HTTP/2.0 is negotiated using the [TLS ALPN](https://tools.ietf.org/html/rfc7301) extension, which is only supported in [OpenSSL 1.0.2](https://www.openssl.org/news/openssl-1.0.2-notes.html) and up. These instructions assume you are already familiar with the testing @@ -153,4 +153,4 @@ the HEADER and CONTINUATION frames are constructed in the same way. Ends the stream with the given ID, or the one that request was made on if no ID given. - Parameters - - stream_id: Id of stream to send frame on. Will use the request stream ID if None \ No newline at end of file + - stream_id: Id of stream to send frame on. Will use the request stream ID if None diff --git a/testing/web-platform/tests/docs/writing-tests/lint-tool.md b/testing/web-platform/tests/docs/writing-tests/lint-tool.md index ba11169e020c8..95f8b574158e7 100644 --- a/testing/web-platform/tests/docs/writing-tests/lint-tool.md +++ b/testing/web-platform/tests/docs/writing-tests/lint-tool.md @@ -61,7 +61,7 @@ TRAILING WHITESPACE:example/* Similarly, you can also use -[shell-style wildcards](https://docs.python.org/2/library/fnmatch.html) to +[shell-style wildcards](https://docs.python.org/library/fnmatch.html) to express other filename patterns or directory-name patterns. Finally, to ignore just one line in a file, use the following format: diff --git a/testing/web-platform/tests/docs/writing-tests/python-handlers/index.md b/testing/web-platform/tests/docs/writing-tests/python-handlers/index.md index e4d396f90a796..96f7edb61601b 100644 --- a/testing/web-platform/tests/docs/writing-tests/python-handlers/index.md +++ b/testing/web-platform/tests/docs/writing-tests/python-handlers/index.md @@ -81,21 +81,6 @@ css/css-align/resources/__init__.py This requirement will be removed once we move to Python 3, due to [PEP 420](https://www.python.org/dev/peps/pep-0420/). -### Python3 compatibility - -Even though Python3 is not fully supported at this point, some work is being -done to add compatibility for it. This is why you can see in multiple places -the use of the `six` python module which is meant to provide a set of simple -utilities that work for both generation of python (see -[docs](https://six.readthedocs.io/)). The module is vendored in -tools/third_party/six/six.py. - -When an handler is added, it should be at least syntax-compatible with Python3. -You can check that by running: -``` -python3 -m py_compile -``` - ## Example: Dynamic HTTP headers The following code defines a Python handler that allows the requester to diff --git a/testing/web-platform/tests/docs/writing-tests/server-features.md b/testing/web-platform/tests/docs/writing-tests/server-features.md index a1ba09132c5a4..fe3e84836c21e 100644 --- a/testing/web-platform/tests/docs/writing-tests/server-features.md +++ b/testing/web-platform/tests/docs/writing-tests/server-features.md @@ -127,8 +127,8 @@ by default and needs to be run using `./wpt serve --h2` in order to enable it. The HTTP/2.0 server supports handlers that work per-frame; these, along with the API are documented in [Writing H2 Tests](h2tests). -> Important: The HTTP/2.0 server requires you to have Python 2.7.10+ -and OpenSSL 1.0.2+. This is because HTTP/2.0 is negotiated using the +> Important: The HTTP/2.0 server requires you to have +OpenSSL 1.0.2+. This is because HTTP/2.0 is negotiated using the [TLS ALPN](https://tools.ietf.org/html/rfc7301) extension, which is only supported in [OpenSSL 1.0.2](https://www.openssl.org/news/openssl-1.0.2-notes.html) and up. diff --git a/testing/web-platform/tests/tools/ci/azure/update_hosts.yml b/testing/web-platform/tests/tools/ci/azure/update_hosts.yml index 64aff7cf46a83..63c7e45811297 100644 --- a/testing/web-platform/tests/tools/ci/azure/update_hosts.yml +++ b/testing/web-platform/tests/tools/ci/azure/update_hosts.yml @@ -1,6 +1,3 @@ -parameters: - pyflag: --py3 - steps: - script: ./wpt make-hosts-file | sudo tee -a /etc/hosts displayName: 'Update hosts (macOS)' @@ -8,6 +5,6 @@ steps: - powershell: | $hostFile = "$env:systemroot\System32\drivers\etc\hosts" Copy-Item -Path $hostFile -Destination "$hostFile.back" -Force - python wpt ${{ parameters.pyflag }} make-hosts-file | Out-File $env:systemroot\System32\drivers\etc\hosts -Encoding ascii -Append + python wpt make-hosts-file | Out-File $env:systemroot\System32\drivers\etc\hosts -Encoding ascii -Append displayName: 'Update hosts (Windows)' condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) diff --git a/testing/web-platform/tests/tools/ci/azure/update_manifest.yml b/testing/web-platform/tests/tools/ci/azure/update_manifest.yml index e8f28217f1eaa..453ac2ac3c05c 100644 --- a/testing/web-platform/tests/tools/ci/azure/update_manifest.yml +++ b/testing/web-platform/tests/tools/ci/azure/update_manifest.yml @@ -1,7 +1,4 @@ -parameters: - pyflag: --py3 - steps: # `python wpt` instead of `./wpt` is to make this work on Windows: -- script: python wpt ${{ parameters.pyflag }} manifest +- script: python wpt manifest displayName: 'Update manifest' diff --git a/testing/web-platform/tests/tools/ci/tc/tasks/test.yml b/testing/web-platform/tests/tools/ci/tc/tasks/test.yml index b3a3960689336..95212e97bf796 100644 --- a/testing/web-platform/tests/tools/ci/tc/tasks/test.yml +++ b/testing/web-platform/tests/tools/ci/tc/tasks/test.yml @@ -105,11 +105,6 @@ components: browser-servo: {} - tox-python2: - env: - TOXENV: py27 - PY_COLORS: 0 - tox-python3: env: TOXENV: py36 @@ -402,20 +397,6 @@ tasks: - update_built command: "./tools/ci/ci_built_diff.sh" - - tools/ unittests (Python 2): - use: - - wpt-base - - trigger-pr - - tox-python2 - description: >- - Unit tests for tools running under Python 2.7, excluding wptrunner - command: ./tools/ci/ci_tools_unittest.sh - env: - HYPOTHESIS_PROFILE: ci - schedule-if: - run-job: - - tools_unittest - - tools/ unittests (Python 3.6): description: >- Unit tests for tools running under Python 3.6, excluding wptrunner @@ -447,28 +428,6 @@ tasks: run-job: - tools_unittest - - tools/ integration tests (Python 2): - description: >- - Integration tests for tools running under Python 2.7 - use: - - wpt-base - - trigger-pr - - tox-python2 - command: ./tools/ci/ci_tools_integration_test.sh - install: - - libnss3-tools - options: - oom-killer: true - browser: - - firefox - - chrome - channel: experimental - xvfb: true - hosts: true - schedule-if: - run-job: - - wpt_integration - - tools/ integration tests (Python 3.6): description: >- Integration tests for tools running under Python 3.6 @@ -515,23 +474,6 @@ tasks: run-job: - wpt_integration - - resources/ tests (Python 2): - description: >- - Tests for testharness.js and other files in resources/ under Python 2.7 - use: - - wpt-base - - trigger-pr - - tox-python2 - command: ./tools/ci/ci_resources_unittest.sh - options: - browser: - - firefox - xvfb: true - hosts: true - schedule-if: - run-job: - - resources_unittest - - resources/ tests (Python 3.6): description: >- Tests for testharness.js and other files in resources/ under Python 3.6 @@ -572,32 +514,6 @@ tasks: run-job: - resources_unittest - - infrastructure/ tests: - description: >- - Smoketests for wptrunner - vars: - channel: nightly - use: - - wpt-base - - trigger-pr - - browser-firefox - command: ./tools/ci/ci_wptrunner_infrastructure.sh --py2 - install: - - libnss3-tools - - libappindicator1 - - fonts-liberation - options: - oom-killer: true - browser: - - firefox - - chrome - channel: experimental - xvfb: true - hosts: false - schedule-if: - run-job: - - wptrunner_infrastructure - - infrastructure/ tests (Python 3): description: >- Smoketests for wptrunner diff --git a/testing/web-platform/tests/tools/ci/tc/tests/test_valid.py b/testing/web-platform/tests/tools/ci/tc/tests/test_valid.py index 30fdfdc13d88e..9891e1cfc5d98 100644 --- a/testing/web-platform/tests/tools/ci/tc/tests/test_valid.py +++ b/testing/web-platform/tests/tools/ci/tc/tests/test_valid.py @@ -132,17 +132,13 @@ def test_verify_payload(): 'lint']), ("pr_event.json", True, {".taskcluster.yml", ".travis.yml", "tools/ci/start.sh"}, ['lint', - 'tools/ unittests (Python 2)', 'tools/ unittests (Python 3.6)', 'tools/ unittests (Python 3.8)', - 'tools/ integration tests (Python 2)', 'tools/ integration tests (Python 3.6)', 'tools/ integration tests (Python 3.8)', - 'resources/ tests (Python 2)', 'resources/ tests (Python 3.6)', 'resources/ tests (Python 3.8)', 'download-firefox-nightly', - 'infrastructure/ tests', 'infrastructure/ tests (Python 3)', 'sink-task']), # More tests are affected in the actual PR but it shouldn't affect the scheduled tasks diff --git a/testing/web-platform/tests/tools/py3-flake8.ini b/testing/web-platform/tests/tools/py3-flake8.ini index 14cc1dc6f6a7a..f8d4776ef66b0 100644 --- a/testing/web-platform/tests/tools/py3-flake8.ini +++ b/testing/web-platform/tests/tools/py3-flake8.ini @@ -12,16 +12,16 @@ select = E,W,F,N # E402: module level import not at top of file # E731: do not assign a lambda expression, use a def # W504: line break after binary operator +# W601: .has_key() is deprecated, use ‘in’ # W605: invalid escape sequence # N801: class names should use CapWords convention # N802: function name should be lowercase # N806: variable in function should be lowercase -ignore = E128,E129,E226,E231,E251,E265,E302,E303,E305,E402,E731,W504,W605,N801,N802,N806 +ignore = E128,E129,E226,E231,E251,E265,E302,E303,E305,E402,E731,W504,W601,W605,N801,N802,N806 exclude = .tox, pywebsocket, third_party, - wptrunner, wptserve/docs/conf.py, wptserve/tests/functional/docroot/invalid.py max-line-length = 141