Skip to content

tox is testing the source code instead of the package? #2360

Answered by jugmac00
galsasi1989 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @galsasi1989,

a couple of notes:

How can I be sure that only the package which tox creates is tested and source code is ignored?

You can avoid this problem by moving your source code into a src directory.

There are a couple of blog posts out there about this topic:
https://web.archive.org/web/20170615032800/https://enotuniq.org/
https://hynek.me/articles/testing-packaging/
https://blog.ganssle.io/articles/2019/08/test-as-installed.html

Also, it is important how you run your tests.

You run python -m pytest - this adds the current directory to the path, see https://jugmac00.github.io/til/what-is-the-difference-between-invoking-pytest-and-python-m-pytest/

Did this answer your question?

C…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jugmac00
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug:normal affects many people or has quite an impact
2 participants
Converted from issue

This discussion was converted from issue #2359 on February 16, 2022 15:02.