buckket / twtxt

Decentralised, minimalist microblogging service for hackers.
http://twtxt.readthedocs.org/en/stable/
MIT License
1.92k stars 79 forks source link

can't (figure out how to) run coverage #38

Closed tedder closed 8 years ago

tedder commented 8 years ago

I'm hoping someone here can point me in the right direction- I can bump up the unit test coverage if I can get pycov working.

$ py.test --cov-config .coveragerc --cov=twtxt 
========================================== test session starts ==========================================
platform darwin -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /Users/ted/git/twtxt, inifile: 
plugins: cov-2.2.1
collected 6 items 

tests/test_types.py ......Coverage.py warning: No data was collected.
$ py.test --cov-config .coveragerc --cov=twtxt tests/
========================================== test session starts ==========================================
platform darwin -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /Users/ted/git/twtxt, inifile: 
plugins: cov-2.2.1
collected 6 items 

tests/test_types.py ......Coverage.py warning: No data was collected.

This one gives approximately the same coverage percent (13%) as the repo shows, but is obviously incorrect:

$ py.test --cov-config .coveragerc --cov=. tests/
========================================== test session starts ==========================================
platform darwin -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /Users/ted/git/twtxt, inifile: 
plugins: cov-2.2.1
collected 6 items 

tests/test_types.py ......
---------------------------- coverage: platform darwin, python 3.4.3-final-0 ----------------------------
Name               Stmts   Miss  Cover
--------------------------------------
setup                  5      5     0%
tests/test_types      63      0   100%
twtxt/__init__         0      0   100%
twtxt/cli            114    114     0%
twtxt/config          87     87     0%
twtxt/file            20     20     0%
twtxt/helper          47     47     0%
twtxt/http            49     49     0%
twtxt/log             10     10     0%
twtxt/parser          23     23     0%
twtxt/types           51     51     0%
--------------------------------------
TOTAL                469    406    13%

======================================= 6 passed in 0.09 seconds ========================================
timofurrer commented 8 years ago

I had the same issues when I did #29 . I thought it's a problem from pycov in combination with tox because tox moves the code base to a tmp location - and thus doesn't file it's files anymore. I could fix it with the usedevelop=True in tox.

I suggest you wait until #29 is merged or rejected ..

buckket commented 8 years ago

You can run the tests, including coverage, simply by running make test. (which executes: py.test --tb=short -v --cov twtxt/ tests/)

This works fine for me and provides correct results.

Don’t see why you think your result is incorrect, either.

tedder commented 8 years ago

aha, both those commands work, they don't have the "warning: No data was collected" message.