-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added gh-actions YAML file and config (#84)
* added gh-actions yaml file: .github/workflows/tests.yml deleted: .travis.yml deleted: bin/testrepl.py modified for gh-actions: tox.ini * Added for pytest config: pyproject.toml * Added the removed testrepl test case: tests/test_repl.py removed mypy: tox.ini * Update tests/test_repl.py --------- Co-authored-by: Asif Saif Uddin <[email protected]>
- Loading branch information
1 parent
3dc44d9
commit 0b2db19
Showing
6 changed files
with
96 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Tests | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
click-version: ['7.1.2', '8.1.2'] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox tox-gh-actions click==${{ matrix.click-version }} | ||
- name: Test with tox | ||
run: tox |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[tool.pytest.ini_options] | ||
addopts = [ | ||
"--cov=click_repl" | ||
] | ||
|
||
testpaths = [ | ||
"tests", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import click | ||
from click_repl import register_repl | ||
import pytest | ||
|
||
|
||
def test_repl(): | ||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.option("--baz", is_flag=True) | ||
def foo(baz): | ||
print("Foo!") | ||
|
||
|
||
@cli.command() | ||
@click.option("--foo", is_flag=True) | ||
def bar(foo): | ||
print("Bar!") | ||
|
||
|
||
register_repl(cli) | ||
|
||
with pytest.raises(SystemExit): | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
[tox] | ||
envlist = | ||
py{py,34,35,36,37} | ||
linters | ||
py{py,37,38,39,310} | ||
; mypy | ||
click7 | ||
|
||
minversion = 3.7.14 | ||
isolated_build = true | ||
|
||
[gh-actions] | ||
python = | ||
3.7: py37, mypy, click7 | ||
3.8: py38 | ||
3.9: py39 | ||
3.10: py310 | ||
|
||
[testenv] | ||
deps= | ||
style: flake8 | ||
test: pytest | ||
commands= | ||
style: flake8 [] | ||
style: black --check . | ||
test: py.test [] | ||
setenv = | ||
PYTHONPATH = {toxinidir} | ||
deps = | ||
pytest | ||
pytest-cov | ||
mypy | ||
tox | ||
commands = | ||
pytest --basetemp={envtmpdir} | ||
|
||
; [testenv:mypy] | ||
; basepython = python3.7 | ||
; deps = mypy | ||
; commands = mypy src | ||
|
||
[travis] | ||
; This section is used by tox-travis | ||
; https://pypi.python.org/pypi/tox-travis | ||
python= | ||
3.6: py36,linters | ||
[testenv:click7] | ||
basepython = python3.10 | ||
deps = | ||
click==7.1.2 | ||
pytest | ||
pytest-cov | ||
commands = pytest --basetemp={envtmpdir} |