Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting coverage calculations #310

Merged
merged 35 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c0abd19
remove unnecessary files
anilbey Aug 23, 2023
d707ee5
Merge pull request #2 from anilbey/test-tox
anilbey Aug 23, 2023
accabbb
remove builddist
anilbey Aug 23, 2023
b024c55
remove py37 from test.yml
anilbey Aug 23, 2023
438dfe4
simplify setup.py
anilbey Aug 23, 2023
5ac9fb2
Merge pull request #3 from anilbey/tox-remove
anilbey Aug 23, 2023
2bd6c75
remove unused passenv in tox
anilbey Aug 23, 2023
356df25
move tests out of package
anilbey Aug 23, 2023
88b16d6
update Makefile
anilbey Aug 23, 2023
740b55a
update Makefile remove old nosetest commands
anilbey Aug 23, 2023
15d05aa
delete .codeclimate.yml
anilbey Aug 23, 2023
464d61e
stay with the old versioneer
anilbey Aug 23, 2023
0f0a887
update .gitignore
anilbey Aug 23, 2023
a35e28c
update make clean paths after moving tests out
anilbey Aug 23, 2023
1b1078d
Correctly calculating the coverage
anilbey Aug 23, 2023
a4cd401
add back bdist_wheel to setup.cfg
anilbey Aug 23, 2023
50ebfea
Revert "add back bdist_wheel to setup.cfg"
anilbey Aug 23, 2023
673168c
add back docs to test.yml
anilbey Aug 23, 2023
c638a67
tox fix envdir
anilbey Aug 23, 2023
9ff3a3f
tox pytest add -sx flags
anilbey Aug 23, 2023
3cc716c
use coverage instead of pytest-cov
anilbey Aug 23, 2023
2fa807c
revert envdir
anilbey Aug 23, 2023
4fd463a
revert deps
anilbey Aug 23, 2023
795b224
revert pytest
anilbey Aug 23, 2023
2b366a3
add usedevelop=True
anilbey Aug 23, 2023
6ad686d
use pytest-cov back again
anilbey Aug 23, 2023
0f98840
merge tox into master
anilbey Aug 23, 2023
e7eaf39
upload coverage only once
anilbey Aug 23, 2023
e5c5188
remove py37 from gh actions
anilbey Aug 23, 2023
b29a3bb
report cpp coverage as well as python
anilbey Aug 24, 2023
16b2b58
performance: separate coverage tox environment
anilbey Aug 24, 2023
7f74680
performance pytest-xdist for test tox env
anilbey Aug 24, 2023
eb39a2a
separate coverage ci action
anilbey Aug 24, 2023
52f4e61
rename Python coverage-> coverage since we add c++ as well
anilbey Aug 24, 2023
a95e29e
update test.yml comment for clarity
anilbey Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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
Loading