Replies: 2 comments 11 replies
-
Hi @lmilbaum , have you tried using one of tox configs: This will build and install your package before the tests run. I also recommend using a |
Beta Was this translation helpful? Give feedback.
-
Firstly, like Anderson said, using the src layout is a good idea: https://blog.ganssle.io/articles/2019/08/test-as-installed.html. If you don't, you should be aware of the differences between invoking But I feel like you may be asking about something else. Could you clarify what your test is? For the regular tests, when you use https://tox.wiki/en/latest/config.html#generating-environments-conditional-settings to run your tests under multiple envs, tox creates virtualenvs for each and installs your project there. It caches the envs so subsequent runs don't recreate those venvs. But you can force this behavior with Another interesting feature is If you're really after testing the bulid and install process, though, then your best bet would be to use pytest to create a throwaway virtualenv under the location provided by the
I want to separately address this. It sounds like you believe that your project may contain differences in files shipped for different Python environments. This may be true if your project contains Python C-extensions (written in C or Rust, or something else). But if your project is pure-Python, the packages you'd ship are not different across Python versions (content-wise). For example, if you package such a project as a wheel that contains code with some conditionals and support for both Python 2 and Python 3, such packages are called universal wheels. These days, projects mostly don't care about Python 3 and ship wheels tagged as Check out https://packaging.python.org to see if you have any gaps in understanding of how the Python packaging works. |
Beta Was this translation helpful? Give feedback.
-
I am using pytest+tox as my testing frameworks. I've added a functionality which is probably impacted by the python version. How would I test the package installation while using sandbox?
I've tried few options with no avail. The documentation is not that clear on this topic.
Beta Was this translation helpful? Give feedback.
All reactions