Skip to content

Instantly share code, notes, and snippets.

@d-v-b
Last active June 19, 2025 15:17
Show Gist options
  • Select an option

  • Save d-v-b/687cdee1a3524ab392cc34ececdb582a to your computer and use it in GitHub Desktop.

Select an option

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
# /// 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