Skip to content

Commit

Permalink
Merge pull request #12 from exabl/enh/pytest-cov
Browse files Browse the repository at this point in the history
Coverage
  • Loading branch information
ashwinvis committed Sep 9, 2020
2 parents 87ab5e7 + f9ee6c1 commit ac2d102
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip wheel
pip install .[tests]
- name: Run tests
run: |
source activate.sh
pytest -s --cov=src
pytest -s
- name: Upload coverage to codecov
if: ${{ success() }}
run: bash <(curl -s https://codecov.io/bash)
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm[toml]>=3.4.2"]
[tool.setuptools_scm]
write_to = "src/snek5000/_version.py"
write_to_template = "__version__ = \"{version}\"\n"

[tool.pytest.ini_options]
addopts = "--cov=src --cov=tests"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ docs =
tests =
pytest
pytest-cov
ipython
phill @ git+https://github.com/exabl/snek5000-phill.git

hpc =
%(tests)s
ipython
click

dev =
Expand Down
12 changes: 12 additions & 0 deletions tests/test_magic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest
try:
from IPython.testing.globalipapp import get_ipython
ip = get_ipython()
ip.magic('load_ext snek5000.magic')
except ImportError:
ip = False


@pytest.mark.skipif(not ip, reason="Magics cannot be tested if IPython is unavailable")
def test_snek5000_magic():
ip.run_line_magic('snek5000', 'kth')

0 comments on commit ac2d102

Please sign in to comment.