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
mypackagewhich is located in thesrcdirectory. The package is uploaded to PyPI where users canpip installit. Tests for the package are run with pytest and are located in thetestsdirectory. Examples of using the package are in theexamplesdirectory. The examples are just scripts as shown below forex1.pyThe purpose of
test_examples.pyis to test the example files, its contents are shown below:When I run pytest in the
myprojectdirectory 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