Skip to content

Testing on Windows doesn't produce coverage data #155

Open
@AstraLuma

Description

@AstraLuma

Specifically, this appveyor config file was run through appveyor and produced this coverage file.

Only on Windows/Appveyor, not Mac/Travis or Linux/Travis, is the coverage information just missing.

Activity

tolomea

tolomea commented on May 18, 2017

@tolomea

This would explain the problems I'm having on Win10. I have following package versions:

coverage==4.3.4
Django==1.11
django-coverage-plugin==1.5.0
pytest==3.0.7
pytest-cov==2.4.0
pytest-django==3.1.2

.coveragerc contains:

[run]
plugins =
    django_coverage_plugin

Running pytest with:

pytest --cov-report term-missing --cov=core

correctly calculates coverage for the Python files in core but doesn't find any of the templates.
I'll see if I can find a Linux or Mac to test on.

ionelmc

ionelmc commented on May 18, 2017

@ionelmc
Member

@tolomea Perhaps there is a problem with the location of the code (eg: it's in in site-packages but all your configuration assumes the files in project's root.

@astronouth7303 I can't see any build output from that appveyor link. Also the coverage file link is broken/expired.

tolomea

tolomea commented on May 19, 2017

@tolomea

@ionelmc the core directory containing the templates is in the current working directory as are .coveragerc and manage.py and as mentioned it finds the py files in that app, just not the templates.

I found a Linux machine to test it on and it happily finds the templates, so it does seem to be a Windows specific issue.

ionelmc

ionelmc commented on May 19, 2017

@ionelmc
Member

@tolomea sounds like a django plugin issue, have you tried reporting it to whomever maintains it?

tolomea

tolomea commented on May 19, 2017

@tolomea

@ionelmc oops, I had mistakenly thought this was a django plugin issue (too many browser tabs :) I'll take it over there, thanks.

ionelmc

ionelmc commented on May 19, 2017

@ionelmc
Member

@astronouth7303 I've now looked over your project and everything seems to work as expected. You have multiple problems in your project tho:

  • overly broad tests collection (not installed and temporary build sources are being collected)
  • lack of import insulation; and because collection is overly broad I suspect it depends on fs order what files are being imported (you may have slug sources from CWD or files from site-packages)

These may be fixed with proper project layout (the src layout) or change of CWD to a temp dir while test runs. Unfortunate consequences of Python putting CWD in sys.path :)

You may still need some coverage configuration. See this or this.

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@AstraLuma@tolomea

        Issue actions

          Testing on Windows doesn't produce coverage data · Issue #155 · pytest-dev/pytest-cov