-
Notifications
You must be signed in to change notification settings - Fork 216
Open
Labels
Description
OS: OSx 10.12.6
coverage (4.4.1)
pytest-cov (2.5.1)
I'm learning how to use coverage and pytest-cov and it reports very strange things.
Missing coverage on docstring example:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__main__.py file of jans_sample_python_package package.
__main__.py is run as '__main__' when you run a package as the main program.
For instance, python -m jans_sample_python_package
"""
Coverage report: https://1oglop1.github.io/jan_cov/src_jans_sample_python_package___main___py.html
Code: https://github.com/1oglop1/covjan/tree/cov2
Can someone please tell me what's wrong or what to read in order to learn more how does this all work together?
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ionelmc commentedon Nov 1, 2017
@1oglop1 it would appear that the code ain't covered at all? What happens if you remove the
# pragma: no cover
from the main function?1oglop1 commentedon Nov 4, 2017
@icemac
Then the result is:
12 statements 0 run 12 missing 0 excluded
Is there anything I can debug or provide you more input?
ionelmc commentedon Nov 4, 2017
Seems to work as expected - you don't test the
jans_sample_python_package.__main__
module at all. To do it, runsubprocess.check_output([sys.executable, '-mjans_sample_python_package'])
or something similar.1oglop1 commentedon Nov 4, 2017
Yey, that fixt the report! Huge thanks!
How about line
3
why"""
is reported was missing?ionelmc commentedon Nov 4, 2017
Module ain't imported, so why would it be covered?