From dca66abb01cf442abdcfd0fa6d8a6e608740cadc Mon Sep 17 00:00:00 2001 From: Joshua Fehler Date: Mon, 27 May 2024 10:46:43 -0400 Subject: [PATCH 1/2] Align tox and CI jobs --- .github/workflows/lint.yml | 37 +++++++++++++++++++++++++++++++++++ .github/workflows/macos.yml | 4 ++-- .github/workflows/main.yml | 35 +++++++-------------------------- .github/workflows/windows.yml | 4 ++-- tox.ini | 24 +++++++++++++++++------ 5 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..5560fbd48 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,37 @@ +# This is a basic workflow to help you get started with Actions + +name: CI-Lint + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [master] + pull_request: + branches: [master] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: install pre-commit + run: pip install pre-commit + + - name: pre-commit cache + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: "pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}" + restore-keys: "pre-commit-" + + - run: pre-commit run --all-files --show-diff-on-failure diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f20f9cf4c..55b64b622 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -10,7 +10,7 @@ on: workflow_dispatch: jobs: - selenium: + tests_selenium_safari: runs-on: macos-latest strategy: @@ -61,4 +61,4 @@ jobs: run: | gtimeout 60 bash -c 'while ! wget -O /dev/null -T 1 http://localhost:4444/readyz; do echo waiting for selenium server; sleep 1; done' || (cat selenium-standalone.log && exit 2) - tox -e tests_macos_selenium -- --cache-clear -n 1 tests || tox -e tests_macos_selenium -- -n 1 --last-failed --last-failed-no-failures none + tox -e tests_selenium_safari -- --cache-clear -n 1 tests || tox -e tests_selenium_safari -- -n 1 --last-failed --last-failed-no-failures none diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ffc0e73ea..350d98848 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - build: + tests: runs-on: ubuntu-latest strategy: @@ -45,13 +45,13 @@ jobs: - name: Run tests run: | - tox -e tests -- -n 4 tests/test_browser.py tests/test_element_list.py tests/test_request_handler.py tests/test_xpath_concat.py + tox -e tests_splinter -- -n 4 - name: Run non-webdriver driver tests run: | - tox -e tests -- -n 4 tests/test_flaskclient.py tests/test_zopetestbrowser.py tests/test_djangoclient.py tests/test_is_element_present_nojs.py + tox -e tests_lxml_drivers -- -n 4 - selenium_remote: + tests_selenium_remote: runs-on: ubuntu-latest strategy: @@ -91,9 +91,9 @@ jobs: xvfb-run java -jar selenium-server.jar standalone > selenium-server.log 2>&1 & timeout 60 bash -c 'while ! wget -O /dev/null -T 1 http://localhost:4444/readyz; do echo waiting for selenium server; sleep 1; done' || (cat selenium-server.log && exit 2) echo "Selenium server is ready, running tests" - tox -e tests_selenium -- tests/test_webdriver_remote.py + tox -e tests_selenium - selenium: + tests_selenium: runs-on: ubuntu-latest strategy: @@ -122,25 +122,4 @@ jobs: - name: Run Selenium tests run: | - tox -e tests_selenium -- -n 4 tests/test_element_is_visible.py tests/test_screenshot.py tests/test_shadow_root.py tests/test_mouse_interaction.py tests/test_async_finder.py tests/test_html_snapshot.py tests/test_iframes.py tests/test_popups.py tests/test_webdriver.py tests/test_webdriver_firefox.py tests/test_webdriver_chrome.py; - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - - name: install pre-commit - run: pip install pre-commit - - - name: pre-commit cache - uses: actions/cache@v4 - with: - path: ~/.cache/pre-commit - key: "pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}" - restore-keys: "pre-commit-" - - - run: pre-commit run --all-files --show-diff-on-failure + tox -e tests_selenium -- -n 4; diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3faf03389..01334dd5e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,7 +10,7 @@ on: workflow_dispatch: jobs: - selenium: + tests_selenium_edge: runs-on: windows-latest strategy: @@ -44,4 +44,4 @@ jobs: - name: Run tests for windows-only drivers run: | - tox -e tests_windows_selenium -- -n 4 tests/test_webdriver.py tests/test_popups.py tests/test_webdriver_edge_chromium.py; + tox -e tests_selenium_edge -- -n 4; diff --git a/tox.ini b/tox.ini index f0f5c085b..f129c622f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,26 +1,38 @@ -[testenv:tests] +[testenv:tests_splinter] +deps = -rrequirements/test.txt +commands = + pytest --ignore-flaky -v {posargs} tests/test_browser.py tests/test_element_list.py tests/test_request_handler.py tests/test_xpath_concat.py + +[testenv:tests_lxml_drivers] extras = zope.testbrowser, django, flask deps = -rrequirements/test.txt commands = - pytest --ignore-flaky -v {posargs} + pytest --ignore-flaky -v {posargs} tests/test_flaskclient.py tests/test_zopetestbrowser.py tests/test_djangoclient.py tests/test_is_element_present_nojs.py [testenv:tests_selenium] extras = selenium deps = -rrequirements/test.txt commands = - pytest --ignore-flaky -m "not macos" -v {posargs} + pytest --ignore-flaky -m "not macos" -v {posargs} tests/test_element_is_visible.py tests/test_screenshot.py tests/test_shadow_root.py tests/test_mouse_interaction.py tests/test_async_finder.py tests/test_html_snapshot.py tests/test_iframes.py tests/test_popups.py tests/test_webdriver.py tests/test_webdriver_firefox.py tests/test_webdriver_chrome.py + +[testenv:tests_selenium_remote] +extras = selenium +deps = + -rrequirements/test.txt +commands = + pytest --ignore-flaky -v {posargs} tests/test_webdriver_remote.py -[testenv:tests_windows_selenium] +[testenv:tests_selenium_edge] extras = selenium deps = -rrequirements\test_windows.txt passenv = EDGEWEBDRIVER commands = - pytest --ignore-flaky -v {posargs} + pytest --ignore-flaky -v {posargs} tests/test_webdriver.py tests/test_popups.py tests/test_webdriver_edge_chromium.py -[testenv:tests_macos_selenium] +[testenv:tests_selenium_safari] extras = selenium deps = -rrequirements/test.txt From 93c98737021acb715a16a6500c85484cfeabe241 Mon Sep 17 00:00:00 2001 From: Joshua Fehler Date: Mon, 27 May 2024 10:49:27 -0400 Subject: [PATCH 2/2] fixup --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index f129c622f..7e378974e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [testenv:tests_splinter] +extras = zope.testbrowser, django, flask deps = -rrequirements/test.txt commands = pytest --ignore-flaky -v {posargs} tests/test_browser.py tests/test_element_list.py tests/test_request_handler.py tests/test_xpath_concat.py