Replies: 1 comment 7 replies
-
pytest has no idea that for a examle test something has to added to the pythonpath, the pythonpath config option is the starting point for |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a project for developing a Python package where the structure of the project is similar to the following:
The project is for developing a Python package named
mypackage
which is located in thesrc
directory. The package is uploaded to PyPI where users canpip install
it. Tests for the package are run with pytest and are located in thetests
directory. Examples of using the package are in theexamples
directory. The examples are just scripts as shown below forex1.py
The purpose of
test_examples.py
is to test the example files, its contents are shown below:When I run pytest in the
myproject
directory I get the error shown here:It looks like pytest is not able to run the files in the examples directory because the location does not allow them to be imported. Any suggestions on how I can test the example files? Should I even use pytest for testing examples or is there a different testing tool for this?
Beta Was this translation helpful? Give feedback.
All reactions