diff --git a/.circleci/config.yml b/.circleci/config.yml index c14af2dfc..fe86da366 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,6 @@ -version: 2 +version: 2.1 +orbs: + codecov: codecov/codecov@3.2.3 defaults: &defaults docker: @@ -100,6 +102,23 @@ jobs: command: | tox -e typechecks + upload_codecov: + docker: + - image: circleci/python:3.9.0 + working_directory: ~/project + steps: + - checkout: + path: ~/project + - run: + name: Run tests and collect coverage + command: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -r test_requirements.txt + coverage run -m pytest -v + coverage report + - codecov/upload + package_and_upload_to_pypi: <<: *defaults steps: @@ -127,6 +146,7 @@ workflows: - test_style - test_docs - test_type + - upload_codecov - package_and_upload_to_pypi: requires: - test_feature_engine_py38 diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..fe137b32d --- /dev/null +++ b/.coveragerc @@ -0,0 +1,15 @@ +# configuration for coverage.py + +[run] +branch = True +source = feature_engine +include = */feature_engine/* +omit = + */setup.py + + +[report] +exclude_lines = + pragma: no cover + +show_missing = True \ No newline at end of file diff --git a/README.md b/README.md index 49e749111..046177544 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,15 @@ [![PyPI version](https://badge.fury.io/py/feature-engine.svg)](https://badge.fury.io/py/feature-engine) [![Conda https://anaconda.org/conda-forge/feature_engine](https://anaconda.org/conda-forge/feature_engine/badges/installer/conda.svg)](https://anaconda.org/conda-forge/feature_engine) [![CircleCI https://app.circleci.com/pipelines/github/feature-engine/feature_engine](https://img.shields.io/circleci/build/github/feature-engine/feature_engine/main)](https://app.circleci.com/pipelines/github/feature-engine/feature_engine?) +[![codecov](https://codecov.io/github/feature-engine/feature_engine/branch/master/graph/badge.svg?token=ZBKKSN6ERL)](https://codecov.io/github/feature-engine/feature_engine) [![Documentation Status https://feature-engine.readthedocs.io/en/latest/index.html](https://readthedocs.org/projects/feature-engine/badge/?version=latest)](https://feature-engine.readthedocs.io/en/latest/index.html) [![Join the chat at https://gitter.im/feature_engine/community](https://badges.gitter.im/feature_engine/community.svg)](https://gitter.im/feature_engine/community) -[![Sponsorship https://www.trainindata.com/](https://img.shields.io/badge/Powered%20By-TrainInData-orange.svg)](https://www.trainindata.com/) [![Downloads](https://pepy.tech/badge/feature-engine)](https://pepy.tech/project/feature-engine) [![Downloads](https://pepy.tech/badge/feature-engine/month)](https://pepy.tech/project/feature-engine) [![DOI](https://zenodo.org/badge/163630824.svg)](https://zenodo.org/badge/latestdoi/163630824) [![DOI](https://joss.theoj.org/papers/10.21105/joss.03642/status.svg)](https://doi.org/10.21105/joss.03642) [![first-timers-only](https://img.shields.io/badge/first--timers--only-friendly-blue.svg?style=flat-square)](https://www.firsttimersonly.com/) +[![Sponsorship https://www.trainindata.com/](https://img.shields.io/badge/Powered%20By-TrainInData-orange.svg)](https://www.trainindata.com/) [](http://feature-engine.readthedocs.io) diff --git a/test_requirements.txt b/test_requirements.txt index 13086c26b..42ebfeb9b 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -3,6 +3,7 @@ pytest>=5.4.1 # repo maintenance tooling black>=21.5b1 +coverage>=6.4.4 flake8>=3.9.2 -mypy>=0.740 isort>=5.8.0 +mypy>=0.740 diff --git a/tox.ini b/tox.ini index caec17dba..627cdc297 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38, py39, py310, docs, stylechecks, typechecks +envlist = py38, py39, py310, codecov, docs, stylechecks, typechecks skipsdist = true [testenv] @@ -8,6 +8,7 @@ envdir = {toxworkdir}/unit_tests setenv = PYTHONPATH=. + COVERAGE_RCFILE = {envtmpdir}/coveragerc commands = pytest tests @@ -25,6 +26,15 @@ deps = deps = -rtest_requirements.txt +[testenv:codecov] +deps = + -rtest_requirements.txt +commands_pre = + {envpython} -c 'from pathlib import Path; Path(r"{env:COVERAGE_RCFILE}").write_text(Path(".coveragerc").read_text())' +commands = + coverage run -m pytest -v + coverage report + [testenv:docs] deps = -r docs/requirements.txt