Skip to content

Commit

Permalink
Added gh-actions YAML file and config (#84)
Browse files Browse the repository at this point in the history
* 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
GhostOps77 and auvipy authored Feb 2, 2023
1 parent 3dc44d9 commit 0b2db19
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 54 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
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
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

25 changes: 0 additions & 25 deletions bin/testrepl.py

This file was deleted.

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tool.pytest.ini_options]
addopts = [
"--cov=click_repl"
]

testpaths = [
"tests",
]
27 changes: 27 additions & 0 deletions tests/test_repl.py
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()
48 changes: 34 additions & 14 deletions tox.ini
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}

0 comments on commit 0b2db19

Please sign in to comment.