Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing on Windows doesn't produce coverage data #155

Open
AstraLuma opened this issue Apr 4, 2017 · 7 comments
Open

Testing on Windows doesn't produce coverage data #155

AstraLuma opened this issue Apr 4, 2017 · 7 comments
Labels

Comments

@AstraLuma
Copy link

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.

@tolomea
Copy link

tolomea commented May 18, 2017

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
Copy link
Member

ionelmc commented May 18, 2017

@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
Copy link

tolomea commented May 19, 2017

@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
Copy link
Member

ionelmc commented May 19, 2017

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

@tolomea
Copy link

tolomea commented May 19, 2017

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

@ionelmc
Copy link
Member

ionelmc commented May 19, 2017

@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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants