-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
status: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictopic: collectionrelated to the collection phaserelated to the collection phasetype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
What's the problem this feature will solve?
pytest seems designed to test Python packages.
However, it's getting used to test applications as well.
The main problem with testing applications is telling pytest how to find the code under test.
Specifically, sys.path
needs modified to include the directory where the code under test lives.
Describe the solution you'd like
I'd like a srcpaths
setting. We already have testpaths
.
srcpaths
would be a list of directories to add to sys.path
.
Any project that isn't an installable package (installable through pip) that wants the source code and test code in different directories needs this.
Alternative Solutions
- Roll your own solutions
- Plugins
- pytest-srcpaths does just this thing.
- pytest-pythonpaths does more
- does this
- also has a site_dirs feature which I still don't understand
- also (undocumented) adds the current directory to sys.path
Additional context
LuminairPrime
Metadata
Metadata
Assignees
Labels
status: help wanteddevelopers would like help from experts on this topicdevelopers would like help from experts on this topictopic: collectionrelated to the collection phaserelated to the collection phasetype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branchtype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature