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

pytest_report_header not working based on location of conftest.py #2257

Closed
4 tasks done
vmuriart opened this issue Feb 16, 2017 · 7 comments
Closed
4 tasks done

pytest_report_header not working based on location of conftest.py #2257

vmuriart opened this issue Feb 16, 2017 · 7 comments
Labels
type: docs documentation improvement, missing or needing clarification

Comments

@vmuriart
Copy link
Contributor

vmuriart commented Feb 16, 2017

Thanks for submitting an issue!

Here's a quick checklist in what to include:

  • Include a detailed description of the bug or suggestion
  • pip list of the virtual environment you are using
  • pytest and operating system versions
  • Minimal example if possible

Environment

platform linux2 -- Python 2.7.9, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /home/travis/build/vmuriart/sqlparse, inifile: setup.cfg
plugins: travis-fold-1.2.0, cov-2.4.0

Issue seen on all python versions tested (PY27, PY33-PY37)
Issue seen on both Windows(AppVeyor) and Linux(Travis)

Details

  • Describe what you were trying to get done.

Trying to add a custom header information per the docs

If tests and conftest.py is located on ./src/tests/conftest.py then the custom information isn't added to the report.

If tests and conftest.py is located on ./tests/conftest.py then the custom information is added to the report.

If tests and conftest.py is located on ./test/conftest.py then the custom information is added to the report.

If tests and conftest.py is located on ./foo/conftest.py then the custom information isn't added to the report.

I've tried setting testpaths to src/tests and src but neither worked.

@vmuriart
Copy link
Contributor Author

Probably somewhere close to this section of code

@nicoddemus
Copy link
Member

Thanks for the report, I think pytest_report_header falls in the same spot of pytest_addoption (see the note on the docs). In that case unfortunately this is not easily fixable, but we should update the docs to add a similar note to pytest_report_header so it doesn't trip users.

@vmuriart
Copy link
Contributor Author

@nicoddemus that sounds about right from what i'm experiencing.

This part has me confused though. if no test paths are specified use current dir as a test path Wouldn't that imply that when I added testpaths to pytest's section in setup.cfg that it would have found it?

@nicoddemus
Copy link
Member

Hmmm good point, that might be something particular to how testpaths is configured internally though.

Regardless, perhaps you would like to open a quick PR to add the note to pytest_report_header in the docs?

vmuriart added a commit to vmuriart/pytest that referenced this issue Feb 17, 2017
vmuriart added a commit to vmuriart/pytest that referenced this issue Feb 17, 2017
@vmuriart
Copy link
Contributor Author

I have no experience w .rst so I'm not sure I wrote it correctly. I'll take a look at testpaths to see whats up.

@vmuriart
Copy link
Contributor Author

On second thought, I'm going to push to just move our tests folder.

@nicoddemus nicoddemus added the type: docs documentation improvement, missing or needing clarification label Feb 17, 2017
@nicoddemus
Copy link
Member

Updated docs in #2261.

Thanks again @vmuriart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs documentation improvement, missing or needing clarification
Projects
None yet
Development

No branches or pull requests

2 participants