-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add utility to replace direct call to pytest.main #11393
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.
thanks @gigiblender this looks great! one request here
48e81c7
to
d70f300
Compare
@areusch I pushed the requested changes. |
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.
nice! just one small comment
|
||
def main(): | ||
test_file = inspect.getsourcefile(sys._getframe(1)) | ||
sys.exit(pytest.main([test_file] + sys.argv[1:])) |
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.
just a nit but do we actually need to determine and pass in the test file name? the examples don't seem to need it
sys.exit(pytest.main([test_file] + sys.argv[1:])) | |
sys.exit(pytest.main(sys.argv[1:])) |
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.
I think running without a specified test file will cause pytest to search the current file for tests.
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.
thanks @gigiblender !
This PR replaces the test call to
pytest.main
with a call to a utility function:
#11318