astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
26.88k stars 782 forks source link

`uv init` should generate a skeleton test suite #8099

Open paveldikov opened 1 month ago

paveldikov commented 1 month ago

What it says on the tin, really. Just like we have src/myproj/__init__.py::hello(), why not also have tests/test_placeholder.py::test_hello() and maybe even tests/conftest.py?

zanieb commented 1 month ago

I don't know if we want to select a test framework yet.

chrisrodrigue commented 1 month ago

No need to import anything, maybe just generate the tests folder and test_hello.py with a docstring in the file.

This should be the same whether someone was using pytest or unittest.

Ravencentric commented 1 month ago

I think this might be better suited as an opt-in configuration in user level uv.toml (See: https://github.com/astral-sh/uv/issues/8098) with the default behaviour being no skeleton test suite.

paveldikov commented 1 month ago

Agree with @chrisrodrigue, and that is what I had in mind.

Although uv may well want to ship its own test framework implementation in future, realistically test case discovery is a pretty ossified interface -- I can't imagine a new test framework implementing something that is radically different from pytest. (excluding pytest-isms such as fixtures, parametrize [sic], etc. In any case the aim here is to give people a fundamental setup for simple 'run hello() and assert test cases, and they can grow the complexity however they see fit)