From 517c36319741dfbd51b2e09df7e49e9ea2401f92 Mon Sep 17 00:00:00 2001 From: francisco souza <108725+fsouza@users.noreply.github.com> Date: Tue, 15 Aug 2023 18:06:53 -0400 Subject: [PATCH] Update the CI config to use pre-commit instead of tox --- .github/workflows/main.yml | 29 +++++++++++++++++++++-------- Makefile | 3 --- requirements/lint.txt | 6 ------ tox.ini | 12 ------------ 4 files changed, 21 insertions(+), 29 deletions(-) delete mode 100644 requirements/lint.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ff00a4aa..505b43837 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,10 +41,6 @@ jobs: - name: Install test dependencies run: pip install tox - # Lint before running unit tests - - name: Run lint - run: tox -e lint - - 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 @@ -59,8 +55,6 @@ jobs: strategy: matrix: include: - - PY_VER: py37 - python-version: 3.7 - PY_VER: py38 python-version: 3.8 - PY_VER: py39 @@ -101,8 +95,6 @@ jobs: strategy: matrix: include: - - PY_VER: py37 - python-version: 3.7 - PY_VER: py38 python-version: 3.8 - PY_VER: py39 @@ -125,3 +117,24 @@ 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@v3 + + - uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: install pre-commit + run: pip install pre-commit + + - name: pre-commit cache + uses: actions/cache@v3 + 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/Makefile b/Makefile index b35b46a2e..bbd279183 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,6 @@ test: dependencies clean @echo "Running all tests..." tox -- $(which) -format: clean dependencies - @flake8 --max-line-length 110 ./splinter ./tests - coverage: dependencies clean @echo "Running all tests with coverage..." @coverage run run_tests.py -w $(which) && coverage report diff --git a/requirements/lint.txt b/requirements/lint.txt deleted file mode 100644 index 013af4267..000000000 --- a/requirements/lint.txt +++ /dev/null @@ -1,6 +0,0 @@ -flake8==5.0.4 -flake8-builtins==2.1.0 -flake8-comprehensions==3.13.0 -flake8-multiline-containers==0.0.19 -flake8-mutable==1.2.0 -pep8-naming==0.13.3 diff --git a/tox.ini b/tox.ini index 4b5cfcd52..475f0869b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,3 @@ -[flake8] -max-line-length = 120 -exclude = - docs - .tox - - [testenv:tests] extras = zope.testbrowser, django, flask deps = -rrequirements/test.txt @@ -28,8 +21,3 @@ passenv = EDGEWEBDRIVER commands= pytest -v {posargs} - - -[testenv:lint] -deps = -rrequirements/lint.txt -commands = flake8