Skip to content

module docstirng reported as missing [misbehave] #171

@1oglop1

Description

@1oglop1

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?

Activity

ionelmc

ionelmc commented on Nov 1, 2017

@ionelmc
Member

@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

1oglop1 commented on Nov 4, 2017

@1oglop1
Author

@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

ionelmc commented on Nov 4, 2017

@ionelmc
Member

Seems to work as expected - you don't test the jans_sample_python_package.__main__ module at all. To do it, run subprocess.check_output([sys.executable, '-mjans_sample_python_package']) or something similar.

1oglop1

1oglop1 commented on Nov 4, 2017

@1oglop1
Author

Yey, that fixt the report! Huge thanks!
How about line 3 why """ is reported was missing?

ionelmc

ionelmc commented on Nov 4, 2017

@ionelmc
Member

Module ain't imported, so why would it be covered?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ionelmc@1oglop1

        Issue actions

          module docstirng reported as missing [misbehave] · Issue #171 · pytest-dev/pytest-cov