Last active
June 19, 2025 15:17
-
-
Save d-v-b/687cdee1a3524ab392cc34ececdb582a to your computer and use it in GitHub Desktop.
pep-723 metadata + pytest for a simple self-contained parameterized code example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = ">=3.11" | |
| # dependencies = [ | |
| # "pytest", | |
| # ] | |
| # /// | |
| import pytest | |
| import sys | |
| @pytest.mark.parametrize('msg', ['hello world\n', 'hello again\n']) | |
| def test(msg: str): | |
| print(msg) | |
| if __name__ == '__main__': | |
| sys.exit(pytest.main(['-s', __file__, f'-c {__file__}'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment