From 9b118c43be113ca369344844f2506303835712c6 Mon Sep 17 00:00:00 2001 From: Carles Sala Date: Tue, 19 Oct 2021 17:01:42 +0200 Subject: [PATCH] Issue 290 - Add `pip check` (#295) * Fix dependency issues * Check dependency issues on lint * Rename pytest task to unit * Stop using tox on github actions * Swtich to macos-10.15 to keep supporting Python 3.6 --- .github/workflows/integration.yml | 4 ++-- .github/workflows/lint.yml | 6 +++--- .github/workflows/minimum.yml | 8 ++++---- .github/workflows/performance.yml | 5 ++--- .github/workflows/quality.yml | 5 ++--- .github/workflows/readme.yml | 6 +++--- .github/workflows/unit.yml | 8 +++++--- Makefile | 2 +- setup.py | 2 ++ tasks.py | 19 +++++++++++++------ tox.ini | 25 +++++++------------------ 11 files changed, 44 insertions(+), 46 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c6945faa5..83019f541 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: [3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-10.15, windows-latest] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} @@ -21,5 +21,5 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install invoke .[test] - - name: Invoke pytest + - name: Run integration tests run: invoke integration diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2f76fd956..0630c2193 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,6 +16,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions - - name: Test with tox - run: tox -e lint + python -m pip install invoke .[dev] + - name: Run lint checks + run: invoke lint diff --git a/.github/workflows/minimum.yml b/.github/workflows/minimum.yml index 121189261..c2472fac2 100644 --- a/.github/workflows/minimum.yml +++ b/.github/workflows/minimum.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: [3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-10.15, windows-latest] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} @@ -20,6 +20,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions - - name: Test with tox - run: tox -e minimum + python -m pip install invoke .[test] + - name: Run tests with minimum versions + run: invoke minimum diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index d22d73833..7469b43ad 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -16,7 +16,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install invoke - pip install .[test] - - name: Test performance + pip install invoke .[test] + - name: Run performance tests run: invoke performance diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index fcf59cfdc..ec4918336 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -16,7 +16,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install invoke - pip install .[test] - - name: Test quality + python -m pip install invoke .[test] + - name: Run quality tests run: invoke quality diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 9fb163133..0671ebd7c 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: [3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest] # skip windows bc rundoc fails + os: [ubuntu-latest, macos-10.15] # skip windows bc rundoc fails steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} @@ -20,6 +20,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + python -m pip install invoke rundoc . - name: Run the README.md - run: tox -e readme + run: invoke readme diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 0da10d675..57f7d2345 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: [3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-10.15, windows-latest] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} @@ -21,8 +21,10 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install invoke .[test] - - name: Invoke pytest - run: invoke pytest + - name: Check dependencies + run: invoke check-dependencies + - name: Run Unit tests + run: invoke unit - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.8 name: Upload codecov report uses: codecov/codecov-action@v2 diff --git a/Makefile b/Makefile index 560e4eb6f..7762176fb 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ fix-lint: ## fix lint issues using autoflake, autopep8, and isort .PHONY: test-unit test-unit: ## run tests quickly with the default Python - invoke pytest + invoke unit .PHONY: test-integration test-integration: ## run integration tests diff --git a/setup.py b/setup.py index 06ac6da81..932ca2002 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,8 @@ 'autodocsumm>=0.1.10', # style check + 'pycodestyle<2.8.0,>=2.7.0', + 'pyflakes<2.4.0,>=2.3.0', 'flake8>=3.7.7,<4', 'flake8-absolute-import>=1.0,<2', 'flake8-builtins>=1.5.3,<1.6', diff --git a/tasks.py b/tasks.py index 169741c4a..b804ef968 100644 --- a/tasks.py +++ b/tasks.py @@ -8,21 +8,26 @@ @task -def pytest(c): +def check_dependencies(c): + c.run('python -m pip check') + + +@task +def unit(c): c.run( - 'pytest ./tests/unit ./tests/performance/tests ./tests/datasets/tests ' + 'python -m pytest ./tests/unit ./tests/performance/tests ./tests/datasets/tests ' '--cov=rdt --cov-report=xml' ) @task def integration(c): - c.run('pytest ./tests/integration') + c.run('python -m pytest ./tests/integration') @task def performance(c): - c.run('pytest -v ./tests/performance/test_performance.py') + c.run('python -m pytest -v ./tests/performance/test_performance.py') @task def quality(c): @@ -58,8 +63,9 @@ def install_minimum(c): @task def minimum(c): install_minimum(c) - c.run('python -m pip check') - c.run('python -m pytest ./tests/unit ./tests/integration ./tests/performance/tests') + check_dependencies(c) + unit(c) + integration(c) @task @@ -79,6 +85,7 @@ def readme(c): @task def lint(c): + check_dependencies(c) c.run('flake8 rdt') c.run('pydocstyle rdt') c.run('flake8 tests --ignore=D') diff --git a/tox.ini b/tox.ini index 83282478a..0f2a6007e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,34 +1,23 @@ [tox] -envlist = py3{6,7,8}-{lint,readme,pytest,minimum} - -[travis] -python = - 3.8: py38-lint, py38-readme, py38-pytest, py38-minimum - 3.7: py37-lint, py37-readme, py37-pytest, py37-minimum - 3.6: py36-lint, py36-readme, py36-pytest, py36-minimum - -[gh-actions] -python = - 3.8: py38-lint, py38-readme, py38-pytest, py38-minimum - 3.7: py37-lint, py37-readme, py37-pytest, py37-minimum - 3.6: py36-lint, py36-readme, py36-pytest, py36-minimum +envlist = py38-lint, py38-performance, py3{6,7,8}-{readme,unit,integration,minimum} [testenv] -passenv = CI TRAVIS TRAVIS_* skipsdist = false skip_install = false deps = invoke readme: rundoc - tutorials: jupyter extras = lint: dev - pytest: test + unit: test + integration: test minimum: test - tutorials: ctgan + performance: test commands = lint: invoke lint readme: invoke readme - pytest: invoke pytest + unit: invoke unit + integration: invoke integration minimum: invoke minimum + performance: invoke performance invoke rmdir {envdir}