15 Commits
Author SHA1 Message Date
rootile 3bc59b6e0a f2/testlib: fix typechecking for None values
Change-Id: Ie744be23d2b7963d8cd8f80cfeae051249e34d34
2026-03-28 14:06:26 +01:00
Rebecca Turnerandrootile cb34b56fea tests/functional2: Fix Python LSP by adjusting imports
See: cl/4840

When importing Python modules, we include `functional2` in the module
path, like this:

    from functional2.testlib.fixtures.env import ManagedEnv

This means that python expects to see a file like
`functional2/testlib/fixtures/env.py`. We run `pytest` from `tests/` in
the `justfile` and have `tests/functional2/__init__.py` so `pytest` in
`meson` is able to find these imports.

However, language servers generally consider the `pyproject.toml` to be
the project root, so (e.g.) `pyright` is unable to follow any of the
`functional2` imports, leading to lots of spurious errors.

In cl/4840 I moved `tests/functional2/pyproject.toml` to
`tests/pyproject.toml`, which worked but was considered aesthetically
unappealing.

This diff is much larger but it's a more elegant solution.

Change-Id: I2983c7b87f88f59a4e3521451a9f5acd6a6a6964
2026-01-23 15:06:51 +01:00
eldritch horrors a7bd1a8a80 tests/f2: allow string lists as config values
not all values are sets. the search path for example is definitely ordered.

Change-Id: Ice94fe324319731ae3a83c757768c48576ba8b36
2026-01-02 13:01:14 +00:00
Maximilian Bosch 8d21057d49 tests/functional2: use bash as builder
...and add both a static bash and busybox into the sandbox for building:

    $ /nix/store/fz43jxs5qfg5vldzk38y2hmrcl58qk18-busybox-1.36.1/bin/sh -c 'declare -A foo'
    /nix/store/fz43jxs5qfg5vldzk38y2hmrcl58qk18-busybox-1.36.1/bin/sh: declare: not found

The reason is that busybox's `sh` doesn't know about `declare` which
means it cannot build derivations with `__structuredAttrs = true;`.

Change-Id: Ie3ca431f862fd3e59dc649582704ae739ee5834a
2025-12-27 11:11:55 +01:00
Commentator2.0 fc0073f540 tests/functional2: provide an empty repository as a global asset (needed for flake tests)
Change-Id: Icef02d7ae9594aa73a1679bed8f98be053fb693c
2025-12-16 11:15:51 +00:00
Commentator2.0 a078462013 tests/functional2: refactor global assets
make the global_assets folder more readable by placing asset pack files
within a dedicated folder instead of building up a mess similar to f1

Change-Id: Ia2c16f38eb6da96e1e73584bd91391ee56acb410
2025-12-16 08:31:40 +00:00
Alois Wohlschlager 7a0b8834a4 Reapply "functional2: fix in the development shell"
This reverts commit 3ef7e0711b.

Change-Id: I5b76d2c2e9b0dd669818c7218493d3e76a6a6964
2025-10-22 07:41:46 +02:00
Jade LovelaceandCommentator2.0 556012e409 functional2: forbid chdir and setting environment
These are a footgun and are not acceptable in functional2 due to thread
safety, effects on other tests, etc.

Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>

Change-Id: I8d7285061eaa9bab27edd52f3646024c8cf605e5
2025-10-13 18:30:51 +02:00
eldritch horrors 3ef7e0711b Revert "functional2: fix in the development shell"
This reverts commit 42691f0d94.

Reason for revert: darwin builds time out now, apparently due to newly appearing infinite loops in the test suite

Change-Id: I81a09efd53636a287f3095ac87ed8854b6e57922
2025-10-10 12:49:45 +00:00
Alois Wohlschlager 42691f0d94 functional2: fix in the development shell
The functional2 test suite was broken in the development shell for two mostly
separate reasons leading to "no such file or directory" errors:

* The `BUILD_TEST_SHELL` (already containing the correct path) would always be
  set from the Meson option `build_test_shell`, even to the empty string if
  that option is not set. Skip the overwrite in this case to make the
  environment variable work again.
* Sandboxed builds would fail to find their builder `/bin/sh`, since in the
  development shell busybox is not found, so no sandbox shell gets configured.
  Use the shell from `BUILD_TEST_SHELL` instead. (How this does not break the
  old functional tests remains a mystery.)

Change-Id: I6a6a696424e8caaef3f9b68e3738bfd58ea0b056
2025-10-07 20:14:48 +00:00
Commentator2.0andCommentator2.0 7b6a85982b tests/functional2: provide a way to easily access often used assets
Change-Id: I461ee08d9752d972e7485e15186426f98e68ba13
2025-08-24 10:38:39 +02:00
Commentator2.0andCommentator2.0 8bbd5e1d0d tests/functional2: do not copy testlib tests to internal environment
When testing specific internal functionallity while needing things from
the testlib, so far, the tests for the testlib have always been copied
too.
To reduce the amount of additional program required when later making
the env of the pytest_command declarative, and to not test the same
tests a multitude of times (and potentially reaching infinite recursion)
those tests will no longer be copied

Change-Id: I36ec3824a21ed30f9b8ff19948031d1edbf6c76c
2025-08-07 14:25:51 +02:00
Commentator2.0 afa5b924cd tests/functional2: improve type checking util
currently, there is a small helper funciton in lang_util to check if
something is of a list type generic

to improve re-usability, this function is moved to utils and improved to
be also check for nested iterables and such

Change-Id: I92984daa4c4decf13d340a2ea5e52f724cee800e
2025-06-07 00:14:57 +02:00
Commentator2.0 f7914e89e6 tests/functional2: add framework for lang tests
This creates a framework similar to the old lang.sh from functional.
Some notable changes:
- instead of having a .flags file, a test.toml can declare flags
- additionally the test.toml can also declare extra files and multiple
runners for the given input file.
- there won't be any old tests hanging around anymore which weren't
deleted properly in the installation
- all files for a single test are defined decleratively and there won't
be any residues

Tests can be placed within the functional2/lang folder
most migrations should be rather clean

Implements: #825

Change-Id: I5f9149903ec5b078008969a4ae77305417c11475
2025-06-01 20:19:37 +02:00
Commentator2.0 761a4f544c tests/functional2: add utils for files and paths; add pytest_command fixture
Add utils for general-use functions and paths

Additionally introduces a pytest_command fixture, which creates a
testing environment for pytest within the tmp_path. This allows for
encapsulated testing of our frameworks (i.e. snapshot, lang etc)

Change-Id: Ic0a5bc4bfc0b0bfbac15bc51dd4a94fae6ee6f26
2025-06-01 20:19:37 +02:00