Skip to content

Commit

Permalink
Correcting coverage calculations (#310)
Browse files Browse the repository at this point in the history
* remove unnecessary files

* remove builddist

* remove py37 from test.yml

* simplify setup.py

* remove unused passenv in tox

* move tests out of package

* update Makefile

* update Makefile remove old nosetest commands

* delete .codeclimate.yml

* stay with the old versioneer

* update .gitignore

* update make clean paths after moving tests out

* Correctly calculating the coverage

* add back bdist_wheel to setup.cfg

* Revert "add back bdist_wheel to setup.cfg"

This reverts commit 37da209.

* add back docs to test.yml

* tox fix envdir

* tox pytest add -sx flags

* use coverage instead of pytest-cov

* revert envdir

* revert deps

* revert pytest

* add usedevelop=True

* use pytest-cov back again

* upload coverage only once

* remove py37 from gh actions

* report cpp coverage as well as python

* performance: separate coverage tox environment

* performance pytest-xdist for test tox env

* separate coverage ci action

removed unnecessary if check in coverage yaml

switch  to codecov-action@v3

add .codecov.yml with branch coverage gcov

add --branches flag to gcovr

branch detection: no codecov.yml

gcovr treat pratials as hits

gcov to give txt output

delete .codecov.yml

mention txt format gcovr

try json format for gcovr

gcovr output -> xml

* rename Python coverage-> coverage since we add c++ as well

* update test.yml comment for clarity
  • Loading branch information
anilbey authored Aug 24, 2023
1 parent 235a642 commit 3537cf3
Show file tree
Hide file tree
Showing 58 changed files with 89 additions and 102 deletions.
17 changes: 0 additions & 17 deletions .codeclimate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python: [cp37, cp38, cp39, cp310, cp311]
python: [cp38, cp39, cp310, cp311]
arch: [x86_64, amd64]
exclude:
- os: macos-latest
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand All @@ -26,10 +26,32 @@ jobs:
pip install tox tox-gh-actions
- name: Run tox
run: tox
run: tox # this does not call docs

coverage:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install tox tox-gh-actions
- name: Run tox coverage
run: tox -e coverage # specify the coverage environment

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
docs:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
.vscode
*.so
coverage.xml
cpp_coverage.xml
docs/bin
docs/lib
docs/source/lib
bin
*.tox-info.json
*.ipynb_checkpoints
lib
fllog.txt
13 changes: 2 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
TEST_REQUIREMENTS=nose coverage virtualenv

all: install
install: clean
python setup.py sdist
Expand All @@ -25,27 +23,20 @@ doc_upload: doc
git commit -m "Updating docs" && \
git push "git@github.com:BlueBrain/eFEL.git" master:gh-pages --force && \
rm -rf .git
install_test_requirements:
pip install -q $(TEST_REQUIREMENTS) --upgrade
update_version:
cd efel && \
python -c 'import version; version._get_version_number()' && \
git add GITHASH.txt && \
git add VERSION.txt && \
git commit -m 'Updated version number'
test: virtualenv install install_test_requirements
cd efel/tests; nosetests -s -v -x --with-coverage --cover-xml \
--cover-package efel
debugtest: virtualenv install install_test_requirements
cd efel/tests; nosetests -a debugtest -s -v -x --with-coverage --cover-xml \
--cover-package efel
pypi: test
pip install twine --upgrade
rm -rf dist
python setup.py sdist bdist
twine upload dist/*
clean:
rm -rf efel/tests/log/fllog.txt
rm -f tests/log/fllog.txt
rm -f fllog.txt
rm -rf build_cmake
rm -rf build
rm -rf docs/build
Expand Down
5 changes: 2 additions & 3 deletions efel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
from efel.api import *
import efel.io

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
from . import _version
__version__ = _version.get_versions()['version']
19 changes: 0 additions & 19 deletions misc/pytest_migration/convert_pytest.sh

This file was deleted.

16 changes: 0 additions & 16 deletions package.json

This file was deleted.

10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tool.coverage.run]
omit = [
"efel/_version.py"
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError"
]
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ versionfile_source = efel/_version.py
versionfile_build = efel/_version.py
tag_prefix =
parentdir_prefix =

# Package support both python 2.6 and 2.7
[bdist_wheel]
universal = 1
26 changes: 14 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
""" eFEL setup """

# pylint: disable=C0325

"""
Copyright (c) 2015, EPFL/Blue Brain Project
Expand All @@ -21,10 +19,8 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""

try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension # pylint: disable=E0611,F0401

from setuptools import setup, Extension

import os
import versioneer
Expand Down Expand Up @@ -67,14 +63,22 @@
'cppcore',
filename) for filename in cppcore_headers]


coverage_flags = []
if os.environ.get('EFEL_COVERAGE_BUILD'):
coverage_flags = ['-fprofile-arcs', '-ftest-coverage']

cppcore = Extension('efel.cppcore',
sources=cppcore_sources,
include_dirs=['efel/cppcore/'])
include_dirs=['efel/cppcore/'],
extra_compile_args=coverage_flags,
extra_link_args=coverage_flags)

setup(
name="efel",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['numpy>=1.6', 'six'],
install_requires=['numpy>=1.6'],
extras_require={'neo': ['neo[neomatlabio]>=0.5.1']},
packages=['efel', 'efel.pyfeatures', 'efel.units'],
author="BlueBrain Project, EPFL",
Expand All @@ -90,11 +94,11 @@
"features to be calculated. The library will then extract the requested "
"features and return the values to the user.",
license="LGPLv3",
keywords=(
keywords=[
'feature',
'extraction',
'electrophysiology',
'BlueBrainProject'),
'BlueBrainProject'],
url='https://github.com/BlueBrain/eFEL',
classifiers=[
'Development Status :: 4 - Beta',
Expand All @@ -108,8 +112,6 @@
'Topic :: Utilities'],
package_data={
'': ['DependencyV5.txt',
'VERSION.txt',
'README.md',
'GITHASH.txt',
'units/units.json'] + cppcore_headers},
ext_modules=[cppcore])
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
48 changes: 33 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
[tox]
envlist = docs,py3-{style,test}
envlist = docs,py3-{test}
minversion = 4
[gh-actions]
python =
3.7: py3
3.8: py3
3.9: py3
3.10: py3
3.11: py3


[testenv]
envdir =
py3{7,8,9,10,11,}{,-style,-test}: {toxworkdir}/py3
envdir = {toxworkdir}/py3-test
deps =
pytest
pytest-cov
coverage
scipy
style: pycodestyle
pytest>=7.3.1
scipy>=1.10.1
pycodestyle>=2.11.0
pytest-xdist>=3.3.1
extras =
neo
usedevelop=True
commands =
pycodestyle --ignore=E402,W503,W504 efel tests
pytest -sx -n auto tests


[testenv:coverage]
envdir = {toxworkdir}/py3-coverage
setenv =
EFEL_COVERAGE_BUILD = 1
deps =
pytest>=7.3.1
scipy>=1.10.1
pytest-cov>=4.1.0
coverage>=7.3.0
gcovr
allowlist_externals =
make
find
rm
extras =
neo
passenv = https_proxy
usedevelop=True
commands =
make clean

style: pycodestyle --ignore=E402,W503,W504 efel

test: pytest -sx --cov=efel --cov-report=xml efel/tests
python setup.py build_ext --inplace
pytest -sx --cov=efel --cov=tests --cov-report=xml tests
gcovr --print-summary -r . --xml -o cpp_coverage.xml
rm -f ./*.gcov
coverage report -m


[testenv:docs]
Expand Down

0 comments on commit 3537cf3

Please sign in to comment.