Skip to content

Commit

Permalink
Issue 290 - Add pip check (#295)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Carles Sala authored Oct 19, 2021
1 parent 8fd6c09 commit 9b118c4
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions .github/workflows/minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
5 changes: 2 additions & 3 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
8 changes: 5 additions & 3 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
19 changes: 13 additions & 6 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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')
Expand Down
25 changes: 7 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 9b118c4

Please sign in to comment.