From b2522b8dbcf6194fdd6b9a27bbc85eb9c30692f8 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Mon, 2 Oct 2017 19:17:54 +0300 Subject: [PATCH 1/4] add pytest-cov dependency --- requirements.txt | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b070fe0ed..b7bf943ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,6 +13,7 @@ numpy==1.13.3 TA-Lib==0.4.10 pytest==3.2.2 pytest-mock==1.6.3 +pytest-cov==2.5.1 # Required for plotting data #matplotlib==2.0.2 diff --git a/setup.py b/setup.py index 2cd551cb2..e89fd2eee 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup(name='freqtrade', packages=['freqtrade'], scripts=['bin/freqtrade'], setup_requires=['pytest-runner'], - tests_require=['pytest', 'pytest-mock'], + tests_require=['pytest', 'pytest-mock', 'pytest-cov'], install_requires=[ 'python-bittrex==0.1.3', 'SQLAlchemy==1.1.13', From 8500032bff2778003998efbe13c70ee0e3d82184 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Mon, 2 Oct 2017 19:27:18 +0300 Subject: [PATCH 2/4] add coverage config file to omit test files from coverage report --- .coveragerc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..3d5e5889f --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = freqtrade/tests/* From 27b2624a6784a69d72e1a38a0da00bea83b47009 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Mon, 2 Oct 2017 19:27:50 +0300 Subject: [PATCH 3/4] let pytest do coverage --- .travis.yml | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa1e01d31..a2a69c9e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: - pip install coveralls - pip install -r requirements.txt script: -- coverage run --source=freqtrade setup.py test +- python setup.py test after_success: - coveralls notifications: diff --git a/setup.cfg b/setup.cfg index c5d8a376a..ea59030de 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,4 +2,4 @@ test=pytest [tool:pytest] -addopts = --pyargs freqtrade +addopts = --cov=freqtrade --cov-config=.coveragerc freqtrade/tests/ From 3506e3ceec2bc5c7669cf136ae8c19d2b3803853 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Mon, 2 Oct 2017 20:17:14 +0300 Subject: [PATCH 4/4] try directly invoking pytest for fixing coveralls issue --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a2a69c9e3..461324f45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: - pip install coveralls - pip install -r requirements.txt script: -- python setup.py test +- pytest --cov=freqtrade --cov-config=.coveragerc freqtrade/tests/ after_success: - coveralls notifications: