-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(python): Detecting tests in nested directories. #1572
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you revert this commit f1140c0 ? Only the first commit is needed based on my testing. Please could you share more information?
Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot. |
According to my tests, the version I suggest with that commit works better, finds tests that are nested deeper. Please see this short test script: import tempfile
import glob
import os
import pathlib
if __name__ == '__main__':
tmp_dir = tempfile.mkdtemp()
os.chdir(tmp_dir)
pathlib.Path('l1/l2/tests/some_test.txt').mkdir(parents=True, exist_ok=True)
pathlib.Path('l1/l2/something_else').mkdir(parents=True, exist_ok=True)
pathlib.Path('l1-bis/tests').mkdir(parents=True, exist_ok=True)
print('glob.glob("tests"): ', glob.glob("tests"))
print('glob.glob("**/tests"): ', glob.glob("**/tests"))
print('glob.glob("tests", recursive=True): ', glob.glob("tests", recursive=True))
print('glob.glob("**/tests", recursive=True): ', glob.glob("**/tests", recursive=True)) My output:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sometimes tests are not on the same level as the current working directory. PyTest doesn't have a problem with this, neither should we.