On Tue, Sep 02, 2025 at 02:23:23PM +0200, Stefano Brivio wrote:
On Tue, 2 Sep 2025 20:41:41 +1000 David Gibson
wrote: On Tue, Sep 02, 2025 at 09:39:53AM +0200, Stefano Brivio wrote:
On Mon, 1 Sep 2025 14:25:14 +1000 David Gibson
wrote: +def test_make(target: str, expected_files: list[str]) -> None: + """Test `make {target}` + + Arguments: + target -- make target to invoke + expected_files -- files make is expected to create + + Verifies that + 1) `make target` completes successfully + 2) expected_files care created by `make target` + 3) expected_files are removed by `make clean` + """ + + ex_paths = [Path(f) for f in expected_files] + with clone_sources(): + for p in ex_paths: + assert not p.exists(), f"{p} existed before make" + sh(f'make {target} CFLAGS="-Werror"') + for p in ex_paths: + assert p.exists(), f"{p} wasn't made" + sh('make clean') + for p in ex_paths: + assert not p.exists(), f"{p} existed after make clean" + + +exeter.register('make_passt', test_make, 'passt', ['passt']) +exeter.register('make_pasta', test_make, 'pasta', ['pasta']) +exeter.register('make_qrap', test_make, 'qrap', ['qrap']) +exeter.register('make_all', test_make, 'all', ['passt', 'pasta', 'qrap'])
I guess I'm missing something, but how do you set descriptions from Python?
There are two ways: 1)
foo = exeter.register(...) foo.set_description("test that does the thing")
2)
By default exeter will take it from the first line of the test function's docstring.
Ah, this is really convenient. I mean I saw it happening but I wasn't sure why. :)
To be a little more specific here, exeter.register will introspect the docstring and put it in the description. @exeter.test calls exeter.register, so it does the same thing. If you register with parameters it will expand Python-style formatting parameters in the docstring. This is useful for something like: def test_n(n : int): """Test the thing {n} times""" ... for i in range(3): exeter.register(f'test_{i}', test_n, i) You can always overwrite the default description afterwards with set_description. register_pipe() won't set a description automatically, but you can still set one explicitly afterwards. The Scenario stuff... I haven't checked, it's probably needs some work. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson