lix/tests/functional2
jade 3caf3e1e08 testsuite: add a functional2 test suite based on pytest
I am tired of bad shell scripts, let me write bad python quickly
instead. It's definitely, $100%, better.

This is not planned as an immediate replacement of the old test suite,
but we::jade would not oppose tests getting ported.

What is here is a mere starting point and there is a lot more
functionality that we need.

Fixes: #488

Change-Id: If762efce69030bb667491b263b874c36024bf7b6
2024-10-09 14:47:39 -07:00
..
testlib testsuite: add a functional2 test suite based on pytest 2024-10-09 14:47:39 -07:00
__init__.py testsuite: add a functional2 test suite based on pytest 2024-10-09 14:47:39 -07:00
conftest.py testsuite: add a functional2 test suite based on pytest 2024-10-09 14:47:39 -07:00
meson.build testsuite: add a functional2 test suite based on pytest 2024-10-09 14:47:39 -07:00
README.md testsuite: add a functional2 test suite based on pytest 2024-10-09 14:47:39 -07:00
test_eval_trivial.py testsuite: add a functional2 test suite based on pytest 2024-10-09 14:47:39 -07:00

functional2 tests

This uncreatively named test suite is a Pytest based replacement for the shell framework used to write traditional Nix integration tests. Its primary goal is to make tests more concise, more self-contained, easier to write, and to produce better errors.

Goals

  • Eliminate implicit dependencies on files in the test directory as well as the requirement to copy the test files to the build directory as is currently hacked in the other functional test suite.
    • You should be able to write a DirectoryTree of files for your test declaratively.
  • Reduce the amount of global environment state being thrown around in the test suite.
  • Make tests very concise and easy to reuse code for, and hopefully turn more of what is currently code into data.
    • Provide rich ways of calling nix with pleasant syntax.

TODO: Intended features

  • Expect tests (pytest-expect-test) or snapshot tests (pytest-insta) or, likely, both! We::jade prefer to have short output written in-line as it makes it greatly easier to read the tests, but pytest-expect doesn't allow for putting larger stuff in external files, so something else is necessary for those.
  • Web server fixture: we don't test our network functionality because background processes are hard and this is simply goofy. We could just test it.
  • Nix daemon fixture.
  • Parallelism via pytest-xdist.