Skip to content
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

Merged
merged 1 commit into from
May 23, 2022

Conversation

gigiblender
Copy link
Contributor

@gigiblender gigiblender commented May 20, 2022

This PR replaces the test call to pytest.main

sys.exit(pytest.main([test_file] + sys.argv[1:]))

with a call to a utility function:

#11318

@gigiblender
Copy link
Contributor Author

@areusch

Copy link
Contributor

@areusch areusch left a 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

tests/python/unittest/test_tvmscript_syntax_sugar.py Outdated Show resolved Hide resolved
@gigiblender
Copy link
Contributor Author

thanks @gigiblender this looks great! one request here

@areusch I pushed the requested changes.

Copy link
Member

@driazati driazati left a 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:]))
Copy link
Member

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

Suggested change
sys.exit(pytest.main([test_file] + sys.argv[1:]))
sys.exit(pytest.main(sys.argv[1:]))

Copy link
Contributor Author

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.

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @gigiblender !

@areusch areusch merged commit 553eb1a into apache:main May 23, 2022
@gigiblender gigiblender deleted the pytest-main-remove branch May 23, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants