From cb34b56feab947992d8183fd1056170d488158d0 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Fri, 2 Jan 2026 11:00:45 -0800 Subject: [PATCH] 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 --- justfile | 2 +- pyproject.toml | 3 --- tests/functional2/README.md | 12 ++++++------ tests/functional2/__init__.py | 0 tests/functional2/build/test_fixed.py | 8 ++++---- tests/functional2/build/test_remote.py | 8 ++++---- tests/functional2/build/test_xattrs.py | 8 ++++---- tests/functional2/cli/test_completions.py | 4 ++-- .../commands/test_build/test_build_fod.py | 6 +++--- .../test_build/test_build_multiple_outputs.py | 6 +++--- .../test_build/test_build_output_cycles.py | 6 +++--- .../commands/test_build/test_reference_checks.py | 6 +++--- .../commands/test_build/test_tarball.py | 8 ++++---- .../commands/test_build/test_timeout.py | 6 +++--- .../commands/test_custom_sub_commands.py | 4 ++-- tests/functional2/commands/test_hash.py | 13 ++++--------- tests/functional2/commands/test_search.py | 6 +++--- .../commands/test_store_delete/test_unlink.py | 6 +++--- tests/functional2/commands/test_why_depends.py | 6 +++--- tests/functional2/conftest.py | 16 ++++++++-------- tests/functional2/daemon/test_trust.py | 2 +- tests/functional2/eval/test_attr_paths.py | 2 +- tests/functional2/eval/test_debugger.py | 2 +- tests/functional2/eval/test_eval_cli.py | 4 ++-- tests/functional2/eval/test_eval_trivial.py | 2 +- .../eval/test_experimental_features.py | 2 +- tests/functional2/eval/test_nix_path.py | 8 ++++---- tests/functional2/eval/test_pure_eval.py | 6 +++--- .../functional2/eval/test_symlink_resoultion.py | 6 +++--- .../flakes/test_invalid_flake_lock.py | 2 +- tests/functional2/flakes/test_pure.py | 2 +- tests/functional2/flakes/test_symlink_paths.py | 10 +++++----- .../lang/builtins.getEnv/test_get_env.py | 8 ++++---- .../lang/builtins.pathExists/test_path_exists.py | 14 ++++---------- .../lang/builtins.readDir/test_read_dir.py | 14 ++++---------- .../builtins.readFileType/test_read_file_type.py | 14 ++++---------- .../lang/err_context/test_err_context.py | 2 +- tests/functional2/lang/lang_util.py | 9 ++------- .../lang/search-path/test_search_path.py | 8 ++++---- tests/functional2/lang/test_lang.py | 6 +++--- tests/functional2/lang/test_lang_infra.py | 8 ++++---- tests/functional2/pyproject.toml | 16 ++++++++-------- .../store/cache/test_compression_levels.py | 6 +++--- tests/functional2/store/test_add.py | 4 ++-- tests/functional2/store/test_dump_db.py | 6 +++--- tests/functional2/store/test_evil_nars.py | 4 ++-- tests/functional2/store/test_http.py | 6 +++--- tests/functional2/store/test_xattrs.py | 6 +++--- tests/functional2/testlib/fixtures/command.py | 4 ++-- tests/functional2/testlib/fixtures/env.py | 4 ++-- .../functional2/testlib/fixtures/file_helper.py | 4 ++-- tests/functional2/testlib/fixtures/nix.py | 6 +++--- .../testlib/fixtures/pytest_command.py | 4 ++-- tests/functional2/testlib/fixtures/snapshot.py | 2 +- .../functional2/testlib/fixtures/test_command.py | 6 +++--- tests/functional2/testlib/fixtures/test_env.py | 3 ++- .../testlib/fixtures/test_file_helper.py | 2 +- tests/functional2/testlib/fixtures/test_nix.py | 4 ++-- .../testlib/fixtures/test_snapshot.py | 12 ++++++------ .../testlib/test_terminal_code_eater.py | 2 +- tests/functional2/testlib/test_utils.py | 2 +- tests/functional2/testlib/utils.py | 11 +++-------- tests/functional2/testlib/xattrs.py | 2 +- 63 files changed, 173 insertions(+), 208 deletions(-) delete mode 100644 tests/functional2/__init__.py diff --git a/justfile b/justfile index ce81b660b..15c6ee3c8 100644 --- a/justfile +++ b/justfile @@ -43,7 +43,7 @@ test-integration *OPTIONS: install (test "--suite" "installcheck") # Run functional2 tests using pytest directly, allowing for additional arguments to be passed to pytest e.g. for more granular test selection test-functional2 *OPTIONS: - cd tests && python -m pytest -v {{ OPTIONS }} functional2 + cd tests/functional2 && python -m pytest -v {{ OPTIONS }} alias clang-tidy := lint diff --git a/pyproject.toml b/pyproject.toml index 26279b7d1..b017e590b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,9 +20,6 @@ respect-gitignore = true # show what violations have been fixed show-fixes = true -# need to test if "." or ".." is correct, as we assume functional2 to be the root directory for imports -src = [".."] - [tool.ruff.lint] preview = true diff --git a/tests/functional2/README.md b/tests/functional2/README.md index 2065e6331..59caa1474 100644 --- a/tests/functional2/README.md +++ b/tests/functional2/README.md @@ -47,7 +47,7 @@ Additional testing resources like a temporary directory, asset files, nix comman To check if something equals or a condition is true, use the `assert` expression: ```python -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix # Trivial test def test_example(): @@ -128,7 +128,7 @@ Injecting parameters into a test that are controlled by [fixtures](#useful-fixtu This is currently only used by the `pytest_command` fixture, to test our framework. ```python import pytest -from functional2.testlib.fixtures.pytest_command import Command +from testlib.fixtures.pytest_command import Command @pytest.mark.parametrize("pytest_command", [ ["-k", "fun"], @@ -188,7 +188,7 @@ In order to make its usage easier, one can also use this fixture by using our cu ```python import pytest from pathlib import Path -from functional2.testlib.fixtures.file_helper import File, Symlink, with_files +from testlib.fixtures.file_helper import File, Symlink, with_files @with_files( { @@ -203,7 +203,7 @@ To run a function twice with a different set of files, one can pass multiple dic ```python from pathlib import Path -from functional2.testlib.fixtures.file_helper import File, with_files +from testlib.fixtures.file_helper import File, with_files @with_files( @@ -226,7 +226,7 @@ In order for the golden values to actually update within the code base (compared ```python import pytest -from functional2.testlib.fixtures.file_helper import AssetSymlink, with_files +from testlib.fixtures.file_helper import AssetSymlink, with_files @with_files( @@ -243,7 +243,7 @@ def test_example(snapshot): An object which provides nix executables. ```python -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix # Simple test that runs `nix-instantiate` with some arguments and checks its output def test_err_context(nix: Nix): diff --git a/tests/functional2/__init__.py b/tests/functional2/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/functional2/build/test_fixed.py b/tests/functional2/build/test_fixed.py index f7ca44b5c..14d7192b4 100644 --- a/tests/functional2/build/test_fixed.py +++ b/tests/functional2/build/test_fixed.py @@ -4,10 +4,10 @@ from pathlib import Path import pytest -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.file_helper import with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack @pytest.fixture(autouse=True) diff --git a/tests/functional2/build/test_remote.py b/tests/functional2/build/test_remote.py index 63968f97c..b1183050b 100644 --- a/tests/functional2/build/test_remote.py +++ b/tests/functional2/build/test_remote.py @@ -4,10 +4,10 @@ import textwrap from urllib.parse import urlencode, quote import sys -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.utils import get_global_asset -from functional2.testlib.fixtures.env import ManagedEnv +from testlib.fixtures.nix import Nix +from testlib.fixtures.file_helper import with_files +from testlib.utils import get_global_asset +from testlib.fixtures.env import ManagedEnv @pytest.fixture diff --git a/tests/functional2/build/test_xattrs.py b/tests/functional2/build/test_xattrs.py index 7143313ef..899c73c23 100644 --- a/tests/functional2/build/test_xattrs.py +++ b/tests/functional2/build/test_xattrs.py @@ -2,10 +2,10 @@ import sys import pytest from pathlib import Path -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset, CopyFile -from functional2.testlib.xattrs import verify_no_xattrs_in_tree, skip_if_xattrs_are_unsupported +from testlib.fixtures.file_helper import with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset, CopyFile +from testlib.xattrs import verify_no_xattrs_in_tree, skip_if_xattrs_are_unsupported @with_files( diff --git a/tests/functional2/cli/test_completions.py b/tests/functional2/cli/test_completions.py index 0a3194d0a..c563a71b5 100644 --- a/tests/functional2/cli/test_completions.py +++ b/tests/functional2/cli/test_completions.py @@ -3,8 +3,8 @@ from textwrap import dedent import pytest -from functional2.testlib.fixtures.file_helper import File, with_files, EnvTemplate -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.file_helper import File, with_files, EnvTemplate +from testlib.fixtures.nix import Nix files = { "dep": {"flake.nix": File("{outputs = i: { };}")}, diff --git a/tests/functional2/commands/test_build/test_build_fod.py b/tests/functional2/commands/test_build/test_build_fod.py index e320b9ba0..0cea00f76 100644 --- a/tests/functional2/commands/test_build/test_build_fod.py +++ b/tests/functional2/commands/test_build/test_build_fod.py @@ -1,8 +1,8 @@ import re -from functional2.testlib.fixtures.file_helper import with_files, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.file_helper import with_files, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset _fod_files = { "fod-failing.nix": CopyFile("assets/test_build/fod-failing.nix"), diff --git a/tests/functional2/commands/test_build/test_build_multiple_outputs.py b/tests/functional2/commands/test_build/test_build_multiple_outputs.py index 19d68bb0e..29902d9bc 100644 --- a/tests/functional2/commands/test_build/test_build_multiple_outputs.py +++ b/tests/functional2/commands/test_build/test_build_multiple_outputs.py @@ -1,8 +1,8 @@ import pytest -from functional2.testlib.fixtures.file_helper import with_files, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.file_helper import with_files, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset _mo_files = { diff --git a/tests/functional2/commands/test_build/test_build_output_cycles.py b/tests/functional2/commands/test_build/test_build_output_cycles.py index 348c7baaf..4cb4ba33d 100644 --- a/tests/functional2/commands/test_build/test_build_output_cycles.py +++ b/tests/functional2/commands/test_build/test_build_output_cycles.py @@ -1,9 +1,9 @@ import re import sys -from functional2.testlib.fixtures.file_helper import with_files, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack +from testlib.fixtures.file_helper import with_files, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack _files = { "output-cycles.nix": CopyFile("assets/test_build/output-cycles.nix"), diff --git a/tests/functional2/commands/test_build/test_reference_checks.py b/tests/functional2/commands/test_build/test_reference_checks.py index 1baf14bf7..30234a9d0 100644 --- a/tests/functional2/commands/test_build/test_reference_checks.py +++ b/tests/functional2/commands/test_build/test_reference_checks.py @@ -1,6 +1,6 @@ -from functional2.testlib.fixtures.file_helper import with_files, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack +from testlib.fixtures.file_helper import with_files, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack import pytest diff --git a/tests/functional2/commands/test_build/test_tarball.py b/tests/functional2/commands/test_build/test_tarball.py index 91b39819a..d9773b6d3 100644 --- a/tests/functional2/commands/test_build/test_tarball.py +++ b/tests/functional2/commands/test_build/test_tarball.py @@ -5,10 +5,10 @@ from pathlib import Path import pytest from _pytest.fixtures import FixtureRequest -from functional2.testlib.fixtures.command import Command -from functional2.testlib.fixtures.file_helper import with_files, Symlink, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack, get_global_asset +from testlib.fixtures.command import Command +from testlib.fixtures.file_helper import with_files, Symlink, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack, get_global_asset TAR_FILES = { diff --git a/tests/functional2/commands/test_build/test_timeout.py b/tests/functional2/commands/test_build/test_timeout.py index 616ec337e..a7684d209 100644 --- a/tests/functional2/commands/test_build/test_timeout.py +++ b/tests/functional2/commands/test_build/test_timeout.py @@ -1,6 +1,6 @@ -from functional2.testlib.fixtures.file_helper import with_files, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.file_helper import with_files, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset _files = { "timeout.nix": CopyFile("assets/test_timeout/timeout.nix"), diff --git a/tests/functional2/commands/test_custom_sub_commands.py b/tests/functional2/commands/test_custom_sub_commands.py index 86c14d87f..a0008ff0f 100644 --- a/tests/functional2/commands/test_custom_sub_commands.py +++ b/tests/functional2/commands/test_custom_sub_commands.py @@ -4,8 +4,8 @@ import pytest import signal from pathlib import Path from textwrap import dedent -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.nix import Nix COMMANDS = ["copy-closure", "collect-garbage"] diff --git a/tests/functional2/commands/test_hash.py b/tests/functional2/commands/test_hash.py index 6ce1faa10..7f081eb86 100644 --- a/tests/functional2/commands/test_hash.py +++ b/tests/functional2/commands/test_hash.py @@ -3,15 +3,10 @@ from collections.abc import Callable import pytest -from functional2.testlib.fixtures.file_helper import ( - _init_files, - File, - AssetSymlink, - with_files, - Symlink, -) -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from testlib.fixtures.file_helper import _init_files # noqa: PLC2701 +from testlib.fixtures.file_helper import File, AssetSymlink, with_files, Symlink +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @pytest.mark.parametrize("algo", ["md5", "sha1", "sha256", "sha512"]) diff --git a/tests/functional2/commands/test_search.py b/tests/functional2/commands/test_search.py index 192279218..fb6010102 100644 --- a/tests/functional2/commands/test_search.py +++ b/tests/functional2/commands/test_search.py @@ -3,9 +3,9 @@ import re import pytest -from functional2.testlib.fixtures.file_helper import CopyFile, with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.file_helper import CopyFile, with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset _files = { "search.nix": CopyFile("assets/test_search/search.nix"), diff --git a/tests/functional2/commands/test_store_delete/test_unlink.py b/tests/functional2/commands/test_store_delete/test_unlink.py index 572872901..a8ac9ec09 100644 --- a/tests/functional2/commands/test_store_delete/test_unlink.py +++ b/tests/functional2/commands/test_store_delete/test_unlink.py @@ -2,9 +2,9 @@ import sys import pytest -from functional2.testlib.fixtures.file_helper import with_files, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.file_helper import with_files, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset _mo_files = {"config.nix": get_global_asset("config.nix"), "drv.nix": CopyFile("assets/drv.nix")} diff --git a/tests/functional2/commands/test_why_depends.py b/tests/functional2/commands/test_why_depends.py index d338378fd..f0c32a68f 100644 --- a/tests/functional2/commands/test_why_depends.py +++ b/tests/functional2/commands/test_why_depends.py @@ -1,6 +1,6 @@ -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack +from testlib.fixtures.file_helper import with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack @with_files(get_global_asset_pack("dependencies")) diff --git a/tests/functional2/conftest.py b/tests/functional2/conftest.py index 31742591a..b2294aa3d 100644 --- a/tests/functional2/conftest.py +++ b/tests/functional2/conftest.py @@ -1,10 +1,10 @@ pytest_plugins = ( - "functional2.testlib.fixtures.env", - "functional2.testlib.fixtures.formatter", - "functional2.testlib.fixtures.file_helper", - "functional2.testlib.fixtures.logger", - "functional2.testlib.fixtures.command", - "functional2.testlib.fixtures.nix", - "functional2.testlib.fixtures.snapshot", - "functional2.testlib.fixtures.pytest_command", + "testlib.fixtures.env", + "testlib.fixtures.formatter", + "testlib.fixtures.file_helper", + "testlib.fixtures.logger", + "testlib.fixtures.command", + "testlib.fixtures.nix", + "testlib.fixtures.snapshot", + "testlib.fixtures.pytest_command", ) diff --git a/tests/functional2/daemon/test_trust.py b/tests/functional2/daemon/test_trust.py index f4e12f0b5..40a060e0d 100644 --- a/tests/functional2/daemon/test_trust.py +++ b/tests/functional2/daemon/test_trust.py @@ -1,7 +1,7 @@ import pytest import json -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix @pytest.mark.parametrize( diff --git a/tests/functional2/eval/test_attr_paths.py b/tests/functional2/eval/test_attr_paths.py index f2b82b044..c3197c7c9 100644 --- a/tests/functional2/eval/test_attr_paths.py +++ b/tests/functional2/eval/test_attr_paths.py @@ -1,4 +1,4 @@ -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix import pytest from typing import NamedTuple from textwrap import dedent diff --git a/tests/functional2/eval/test_debugger.py b/tests/functional2/eval/test_debugger.py index 515fbb9dd..60af030ef 100644 --- a/tests/functional2/eval/test_debugger.py +++ b/tests/functional2/eval/test_debugger.py @@ -1,7 +1,7 @@ import re from textwrap import dedent -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix def test_regression_9932(nix: Nix): diff --git a/tests/functional2/eval/test_eval_cli.py b/tests/functional2/eval/test_eval_cli.py index 3df722ea5..6a78f0ba7 100644 --- a/tests/functional2/eval/test_eval_cli.py +++ b/tests/functional2/eval/test_eval_cli.py @@ -3,8 +3,8 @@ from typing import Any import pytest -from functional2.testlib.fixtures.file_helper import with_files, CopyFile, Symlink, File -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.file_helper import with_files, CopyFile, Symlink, File +from testlib.fixtures.nix import Nix @pytest.fixture(autouse=True) diff --git a/tests/functional2/eval/test_eval_trivial.py b/tests/functional2/eval/test_eval_trivial.py index 95baae6a4..0ab8614ea 100644 --- a/tests/functional2/eval/test_eval_trivial.py +++ b/tests/functional2/eval/test_eval_trivial.py @@ -1,4 +1,4 @@ -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix def test_trivial_addition(nix: Nix): diff --git a/tests/functional2/eval/test_experimental_features.py b/tests/functional2/eval/test_experimental_features.py index b404f05af..d62d45c84 100644 --- a/tests/functional2/eval/test_experimental_features.py +++ b/tests/functional2/eval/test_experimental_features.py @@ -1,4 +1,4 @@ -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix # ruff: noqa: N802 diff --git a/tests/functional2/eval/test_nix_path.py b/tests/functional2/eval/test_nix_path.py index 9c62cabab..ea216cfdf 100644 --- a/tests/functional2/eval/test_nix_path.py +++ b/tests/functional2/eval/test_nix_path.py @@ -1,9 +1,9 @@ import pytest -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.file_helper import with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset @with_files({"trivial.nix": get_global_asset("trivial.nix")}) diff --git a/tests/functional2/eval/test_pure_eval.py b/tests/functional2/eval/test_pure_eval.py index 0571b3be3..755f358a3 100644 --- a/tests/functional2/eval/test_pure_eval.py +++ b/tests/functional2/eval/test_pure_eval.py @@ -2,9 +2,9 @@ from pathlib import Path import pytest -from functional2.testlib.fixtures.file_helper import with_files, File, CopyFile -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset +from testlib.fixtures.file_helper import with_files, File, CopyFile +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset use_impure_message = "is forbidden in pure eval mode (use '--impure' to override)" diff --git a/tests/functional2/eval/test_symlink_resoultion.py b/tests/functional2/eval/test_symlink_resoultion.py index abb981669..844cfe1a8 100644 --- a/tests/functional2/eval/test_symlink_resoultion.py +++ b/tests/functional2/eval/test_symlink_resoultion.py @@ -1,9 +1,9 @@ from collections.abc import Callable from pathlib import Path -from functional2.testlib.fixtures.file_helper import with_files, File, AssetSymlink, Symlink -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from testlib.fixtures.file_helper import with_files, File, AssetSymlink, Symlink +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @with_files( diff --git a/tests/functional2/flakes/test_invalid_flake_lock.py b/tests/functional2/flakes/test_invalid_flake_lock.py index fc8eddac5..dca15ef69 100644 --- a/tests/functional2/flakes/test_invalid_flake_lock.py +++ b/tests/functional2/flakes/test_invalid_flake_lock.py @@ -1,7 +1,7 @@ from logging import Logger from pathlib import Path from textwrap import dedent -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix import re diff --git a/tests/functional2/flakes/test_pure.py b/tests/functional2/flakes/test_pure.py index ff7bcb086..d2c6d61a7 100644 --- a/tests/functional2/flakes/test_pure.py +++ b/tests/functional2/flakes/test_pure.py @@ -1,7 +1,7 @@ from logging import Logger from pathlib import Path from textwrap import dedent -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix import re diff --git a/tests/functional2/flakes/test_symlink_paths.py b/tests/functional2/flakes/test_symlink_paths.py index b6e2ae1b1..36af4425a 100644 --- a/tests/functional2/flakes/test_symlink_paths.py +++ b/tests/functional2/flakes/test_symlink_paths.py @@ -1,10 +1,10 @@ from pathlib import Path -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.file_helper import CopyFile, Symlink, with_files, File -from functional2.testlib.utils import get_global_asset_pack -from functional2.testlib.fixtures.command import Command -from functional2.testlib.fixtures.env import ManagedEnv +from testlib.fixtures.nix import Nix +from testlib.fixtures.file_helper import CopyFile, Symlink, with_files, File +from testlib.utils import get_global_asset_pack +from testlib.fixtures.command import Command +from testlib.fixtures.env import ManagedEnv @with_files( diff --git a/tests/functional2/lang/builtins.getEnv/test_get_env.py b/tests/functional2/lang/builtins.getEnv/test_get_env.py index 6e56c870d..b75b12740 100644 --- a/tests/functional2/lang/builtins.getEnv/test_get_env.py +++ b/tests/functional2/lang/builtins.getEnv/test_get_env.py @@ -1,10 +1,10 @@ from collections.abc import Callable from pathlib import Path -from functional2.lang.test_lang import test_eval_okay as nix_eval -from functional2.testlib.fixtures.file_helper import with_files, File, AssetSymlink -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from lang.test_lang import test_eval_okay as nix_eval +from testlib.fixtures.file_helper import with_files, File, AssetSymlink +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @with_files( diff --git a/tests/functional2/lang/builtins.pathExists/test_path_exists.py b/tests/functional2/lang/builtins.pathExists/test_path_exists.py index b09aec1a5..a978ab426 100644 --- a/tests/functional2/lang/builtins.pathExists/test_path_exists.py +++ b/tests/functional2/lang/builtins.pathExists/test_path_exists.py @@ -1,16 +1,10 @@ from pathlib import Path from collections.abc import Callable -from functional2.lang.test_lang import test_eval_okay as nix_eval -from functional2.testlib.fixtures.file_helper import ( - with_files, - CopyFile, - AssetSymlink, - File, - Symlink, -) -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from lang.test_lang import test_eval_okay as nix_eval +from testlib.fixtures.file_helper import with_files, CopyFile, AssetSymlink, File, Symlink +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @with_files( diff --git a/tests/functional2/lang/builtins.readDir/test_read_dir.py b/tests/functional2/lang/builtins.readDir/test_read_dir.py index e589120f6..0152c0be0 100644 --- a/tests/functional2/lang/builtins.readDir/test_read_dir.py +++ b/tests/functional2/lang/builtins.readDir/test_read_dir.py @@ -1,16 +1,10 @@ from collections.abc import Callable from pathlib import Path -from functional2.lang.test_lang import test_eval_okay as nix_eval -from functional2.testlib.fixtures.file_helper import ( - with_files, - CopyFile, - Symlink, - AssetSymlink, - File, -) -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from lang.test_lang import test_eval_okay as nix_eval +from testlib.fixtures.file_helper import with_files, CopyFile, Symlink, AssetSymlink, File +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @with_files( diff --git a/tests/functional2/lang/builtins.readFileType/test_read_file_type.py b/tests/functional2/lang/builtins.readFileType/test_read_file_type.py index b20e220a1..6cd18ef5e 100644 --- a/tests/functional2/lang/builtins.readFileType/test_read_file_type.py +++ b/tests/functional2/lang/builtins.readFileType/test_read_file_type.py @@ -1,16 +1,10 @@ from collections.abc import Callable from pathlib import Path -from functional2.lang.test_lang import test_eval_okay as nix_eval -from functional2.testlib.fixtures.file_helper import ( - with_files, - CopyFile, - Symlink, - AssetSymlink, - File, -) -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from lang.test_lang import test_eval_okay as nix_eval +from testlib.fixtures.file_helper import with_files, CopyFile, Symlink, AssetSymlink, File +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @with_files( diff --git a/tests/functional2/lang/err_context/test_err_context.py b/tests/functional2/lang/err_context/test_err_context.py index 380b8b09d..b6dc8a88a 100644 --- a/tests/functional2/lang/err_context/test_err_context.py +++ b/tests/functional2/lang/err_context/test_err_context.py @@ -1,4 +1,4 @@ -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.nix import Nix def test_err_context(nix: Nix): diff --git a/tests/functional2/lang/lang_util.py b/tests/functional2/lang/lang_util.py index 5106501a2..ec28a08e4 100644 --- a/tests/functional2/lang/lang_util.py +++ b/tests/functional2/lang/lang_util.py @@ -8,13 +8,8 @@ from typing import Any, NamedTuple, ClassVar from collections.abc import Generator import tomllib -from functional2.testlib.fixtures.file_helper import ( - AssetSymlink, - CopyFile, - FileDeclaration, - Fileish, -) -from functional2.testlib.utils import is_value_of_type, test_base_folder, get_global_asset +from testlib.fixtures.file_helper import AssetSymlink, CopyFile, FileDeclaration, Fileish +from testlib.utils import is_value_of_type, test_base_folder, get_global_asset from tomllib import TOMLDecodeError LANG_TEST_ID_PATTERN = "{folder_name}:{test_name}" diff --git a/tests/functional2/lang/search-path/test_search_path.py b/tests/functional2/lang/search-path/test_search_path.py index 4d0783a71..795099663 100644 --- a/tests/functional2/lang/search-path/test_search_path.py +++ b/tests/functional2/lang/search-path/test_search_path.py @@ -1,10 +1,10 @@ from collections.abc import Callable from pathlib import Path -from functional2.lang.test_lang import test_eval_okay as nix_eval -from functional2.testlib.fixtures.file_helper import AssetSymlink, CopyFile, CopyTree, with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from lang.test_lang import test_eval_okay as nix_eval +from testlib.fixtures.file_helper import AssetSymlink, CopyFile, CopyTree, with_files +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot @with_files( diff --git a/tests/functional2/lang/test_lang.py b/tests/functional2/lang/test_lang.py index 03caed4bc..cd53abced 100644 --- a/tests/functional2/lang/test_lang.py +++ b/tests/functional2/lang/test_lang.py @@ -7,9 +7,9 @@ import pytest import yaml from _pytest.python import Metafunc -from functional2.lang.lang_util import LangTest, fetch_all_lang_tests, LangTestRunner -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.fixtures.snapshot import Snapshot +from lang.lang_util import LangTest, fetch_all_lang_tests, LangTestRunner +from testlib.fixtures.nix import Nix +from testlib.fixtures.snapshot import Snapshot def pytest_generate_tests(metafunc: Metafunc): diff --git a/tests/functional2/lang/test_lang_infra.py b/tests/functional2/lang/test_lang_infra.py index 236db8025..941a3ad77 100644 --- a/tests/functional2/lang/test_lang_infra.py +++ b/tests/functional2/lang/test_lang_infra.py @@ -5,10 +5,10 @@ from textwrap import dedent import pytest -from functional2.testlib.fixtures.command import Command -from functional2.testlib.fixtures.file_helper import File, AssetSymlink, with_files -from functional2.testlib.fixtures.snapshot import Snapshot -from functional2.testlib.utils import get_functional2_lang_files +from testlib.fixtures.command import Command +from testlib.fixtures.file_helper import File, AssetSymlink, with_files +from testlib.fixtures.snapshot import Snapshot +from testlib.utils import get_functional2_lang_files @pytest.mark.parametrize("pytest_command", [["-k", "generic_test", "--setup-plan"]], indirect=True) diff --git a/tests/functional2/pyproject.toml b/tests/functional2/pyproject.toml index 2736de012..be1e9137a 100644 --- a/tests/functional2/pyproject.toml +++ b/tests/functional2/pyproject.toml @@ -46,26 +46,26 @@ extend = "../../pyproject.toml" "os.environ".msg = """ Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use: - env= in subprocess functions - - functional2.testlib.commands.Command.with_env for starting subprocesses - - functional2.testlib.environ for read-only access + - testlib.commands.Command.with_env for starting subprocesses + - testlib.environ for read-only access """ "os.environb".msg = """ Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use: - env= in subprocess functions - - functional2.testlib.commands.Command.with_env for starting subprocesses - - functional2.testlib.environ for read-only access + - testlib.commands.Command.with_env for starting subprocesses + - testlib.environ for read-only access """ "os.putenv".msg = """ Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use: - env= in subprocess functions - - functional2.testlib.commands.Command.with_env for starting subprocesses - - functional2.testlib.environ for read-only access + - testlib.commands.Command.with_env for starting subprocesses + - testlib.environ for read-only access """ "os.unsetenv".msg = """ Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use: - env= in subprocess functions - - functional2.testlib.commands.Command.with_env for starting subprocesses - - functional2.testlib.environ for read-only access + - testlib.commands.Command.with_env for starting subprocesses + - testlib.environ for read-only access """ "os.chdir".msg = "Changing current directory is process wide and may interfere with other tests. Use cwd= while spawning a process instead." "os.fchdir".msg = "Changing current directory is process wide and may interfere with other tests. Use cwd= while spawning a process instead." diff --git a/tests/functional2/store/cache/test_compression_levels.py b/tests/functional2/store/cache/test_compression_levels.py index 1a6d869f2..9f63e37af 100644 --- a/tests/functional2/store/cache/test_compression_levels.py +++ b/tests/functional2/store/cache/test_compression_levels.py @@ -1,9 +1,9 @@ import re from pathlib import Path -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack +from testlib.fixtures.file_helper import with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack @with_files(get_global_asset_pack("dependencies")) diff --git a/tests/functional2/store/test_add.py b/tests/functional2/store/test_add.py index ab593b8e1..1884c2333 100644 --- a/tests/functional2/store/test_add.py +++ b/tests/functional2/store/test_add.py @@ -1,7 +1,7 @@ import pytest -from functional2.testlib.fixtures.file_helper import with_files, File, AssetSymlink, Symlink -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.file_helper import with_files, File, AssetSymlink, Symlink +from testlib.fixtures.nix import Nix @with_files({"file-link": AssetSymlink("./test_add.py"), "dir-link": Symlink(".")}) diff --git a/tests/functional2/store/test_dump_db.py b/tests/functional2/store/test_dump_db.py index 56778a308..9b3843327 100644 --- a/tests/functional2/store/test_dump_db.py +++ b/tests/functional2/store/test_dump_db.py @@ -1,8 +1,8 @@ import shutil -from functional2.testlib.fixtures.file_helper import with_files -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.utils import get_global_asset_pack +from testlib.fixtures.file_helper import with_files +from testlib.fixtures.nix import Nix +from testlib.utils import get_global_asset_pack @with_files(get_global_asset_pack("dependencies")) diff --git a/tests/functional2/store/test_evil_nars.py b/tests/functional2/store/test_evil_nars.py index 261bbe8f1..aeaf68994 100644 --- a/tests/functional2/store/test_evil_nars.py +++ b/tests/functional2/store/test_evil_nars.py @@ -6,8 +6,8 @@ from pathlib import Path import pytest -from ..testlib.fixtures.nix import Nix -from ..testlib.nar import ( +from testlib.fixtures.nix import Nix +from testlib.nar import ( DirectoryUnordered, NarItem, NarListener, diff --git a/tests/functional2/store/test_http.py b/tests/functional2/store/test_http.py index ebfea82f8..d27c68200 100644 --- a/tests/functional2/store/test_http.py +++ b/tests/functional2/store/test_http.py @@ -4,9 +4,9 @@ import sqlite3 import aiohttp.web as web import pytest -from functional2.testlib.fixtures.file_helper import File, with_files -from functional2.testlib.fixtures.http_server import http_server -from functional2.testlib.fixtures.nix import Nix +from testlib.fixtures.file_helper import File, with_files +from testlib.fixtures.http_server import http_server +from testlib.fixtures.nix import Nix class HTTPStore: diff --git a/tests/functional2/store/test_xattrs.py b/tests/functional2/store/test_xattrs.py index de352b153..f0e24e189 100644 --- a/tests/functional2/store/test_xattrs.py +++ b/tests/functional2/store/test_xattrs.py @@ -1,9 +1,9 @@ import pytest import sys -from functional2.testlib.fixtures.file_helper import with_files, File -from functional2.testlib.fixtures.nix import Nix -from functional2.testlib.xattrs import verify_no_xattrs_in_tree, skip_if_xattrs_are_unsupported +from testlib.fixtures.file_helper import with_files, File +from testlib.fixtures.nix import Nix +from testlib.xattrs import verify_no_xattrs_in_tree, skip_if_xattrs_are_unsupported import xattr import json diff --git a/tests/functional2/testlib/fixtures/command.py b/tests/functional2/testlib/fixtures/command.py index 0a3213195..3f8648cd9 100644 --- a/tests/functional2/testlib/fixtures/command.py +++ b/tests/functional2/testlib/fixtures/command.py @@ -9,8 +9,8 @@ from typing import Any import pytest -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.terminal_code_eater import eat_terminal_codes +from testlib.fixtures.env import ManagedEnv +from testlib.terminal_code_eater import eat_terminal_codes logger = logging.getLogger(__name__) diff --git a/tests/functional2/testlib/fixtures/env.py b/tests/functional2/testlib/fixtures/env.py index 60e86ed0e..1b016f7f5 100644 --- a/tests/functional2/testlib/fixtures/env.py +++ b/tests/functional2/testlib/fixtures/env.py @@ -4,7 +4,7 @@ import platform import shutil from pathlib import Path -from functional2.testlib.environ import environ +from testlib.environ import environ import pytest @@ -176,7 +176,7 @@ class ManagedEnv: # Set to the codebase internal output if started standalone # This is where the current lix binaries are located. # local import to avoid cyclic dependencies - from functional2.testlib.utils import lix_base_folder # noqa: PLC0415 + from testlib.utils import lix_base_folder # noqa: PLC0415 lix_bin = Path(environ.get("NIX_BIN_DIR", lix_base_folder / "outputs/out/bin")) diff --git a/tests/functional2/testlib/fixtures/file_helper.py b/tests/functional2/testlib/fixtures/file_helper.py index f4064855e..299da82ae 100644 --- a/tests/functional2/testlib/fixtures/file_helper.py +++ b/tests/functional2/testlib/fixtures/file_helper.py @@ -7,8 +7,8 @@ from collections.abc import Callable, Iterable import pytest -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.formatter import BalancedTemplater +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.formatter import BalancedTemplater class Fileish(ABC): diff --git a/tests/functional2/testlib/fixtures/nix.py b/tests/functional2/testlib/fixtures/nix.py index d01105dbd..340f9bb59 100644 --- a/tests/functional2/testlib/fixtures/nix.py +++ b/tests/functional2/testlib/fixtures/nix.py @@ -13,9 +13,9 @@ import logging import pytest -from functional2.testlib.fixtures.command import CommandResult, Command -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.utils import is_value_of_type +from testlib.fixtures.command import CommandResult, Command +from testlib.fixtures.env import ManagedEnv +from testlib.utils import is_value_of_type @dataclasses.dataclass diff --git a/tests/functional2/testlib/fixtures/pytest_command.py b/tests/functional2/testlib/fixtures/pytest_command.py index 41ed9dbd9..3d49caa04 100644 --- a/tests/functional2/testlib/fixtures/pytest_command.py +++ b/tests/functional2/testlib/fixtures/pytest_command.py @@ -1,7 +1,7 @@ import pytest from _pytest.fixtures import FixtureRequest -from functional2.testlib.fixtures.command import Command -from functional2.testlib.fixtures.env import ManagedEnv +from testlib.fixtures.command import Command +from testlib.fixtures.env import ManagedEnv @pytest.fixture(name="pytest_command") diff --git a/tests/functional2/testlib/fixtures/snapshot.py b/tests/functional2/testlib/fixtures/snapshot.py index efc93878f..cc20fdebd 100644 --- a/tests/functional2/testlib/fixtures/snapshot.py +++ b/tests/functional2/testlib/fixtures/snapshot.py @@ -8,7 +8,7 @@ import pytest from _pytest.config import Config from _pytest.fixtures import FixtureRequest -from functional2.testlib.environ import environ +from testlib.environ import environ def pytest_addoption(parser: pytest.Parser) -> None: diff --git a/tests/functional2/testlib/fixtures/test_command.py b/tests/functional2/testlib/fixtures/test_command.py index 85e70f113..8087e0158 100644 --- a/tests/functional2/testlib/fixtures/test_command.py +++ b/tests/functional2/testlib/fixtures/test_command.py @@ -5,9 +5,9 @@ from subprocess import CalledProcessError import pytest from _pytest.logging import LogCaptureFixture -from functional2.testlib.fixtures.command import Command -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.file_helper import File, with_files +from testlib.fixtures.command import Command +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.file_helper import File, with_files def test_command_valid_runs(command: Callable[[list[str]], Command]): diff --git a/tests/functional2/testlib/fixtures/test_env.py b/tests/functional2/testlib/fixtures/test_env.py index 9c7d80006..9ede7c9c4 100644 --- a/tests/functional2/testlib/fixtures/test_env.py +++ b/tests/functional2/testlib/fixtures/test_env.py @@ -6,7 +6,8 @@ from pathlib import Path import pytest -from functional2.testlib.fixtures.env import ManagedEnv, _ManagedPath +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.env import _ManagedPath def test_env_inits_defaults(tmp_path: Path): diff --git a/tests/functional2/testlib/fixtures/test_file_helper.py b/tests/functional2/testlib/fixtures/test_file_helper.py index 792ca89c7..6b2033e98 100644 --- a/tests/functional2/testlib/fixtures/test_file_helper.py +++ b/tests/functional2/testlib/fixtures/test_file_helper.py @@ -2,7 +2,7 @@ from pathlib import Path from textwrap import dedent import pytest -from functional2.testlib.fixtures.file_helper import ( +from testlib.fixtures.file_helper import ( CopyFile, CopyTemplate, CopyTree, diff --git a/tests/functional2/testlib/fixtures/test_nix.py b/tests/functional2/testlib/fixtures/test_nix.py index 16f2f602e..ff831ef0e 100644 --- a/tests/functional2/testlib/fixtures/test_nix.py +++ b/tests/functional2/testlib/fixtures/test_nix.py @@ -3,8 +3,8 @@ from pathlib import Path import pytest -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.nix import NixSettings +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.nix import NixSettings def test_nix_settings_serializes_xf(env: ManagedEnv): diff --git a/tests/functional2/testlib/fixtures/test_snapshot.py b/tests/functional2/testlib/fixtures/test_snapshot.py index bc6a7483b..795118cac 100644 --- a/tests/functional2/testlib/fixtures/test_snapshot.py +++ b/tests/functional2/testlib/fixtures/test_snapshot.py @@ -5,17 +5,17 @@ from textwrap import dedent import pytest from _pytest.logging import LogCaptureFixture -from functional2.testlib.fixtures.command import Command -from functional2.testlib.fixtures.env import ManagedEnv -from functional2.testlib.fixtures.file_helper import ( +from testlib.fixtures.command import Command +from testlib.fixtures.env import ManagedEnv +from testlib.fixtures.file_helper import ( CopyFile, File, FileDeclaration, merge_file_declaration, with_files, ) -from functional2.testlib.fixtures.snapshot import Snapshot -from functional2.testlib.utils import get_functional2_files +from testlib.fixtures.snapshot import Snapshot +from testlib.utils import get_functional2_files def _get_f2_snapshot_files(additional_files: FileDeclaration) -> FileDeclaration: @@ -33,7 +33,7 @@ def _get_f2_snapshot_files(additional_files: FileDeclaration) -> FileDeclaration }, }, "conftest.py": File( - "pytest_plugins = ('functional2.testlib.fixtures.logger', 'functional2.testlib.fixtures.snapshot')" + "pytest_plugins = ('testlib.fixtures.logger', 'testlib.fixtures.snapshot')" ), } }, diff --git a/tests/functional2/testlib/test_terminal_code_eater.py b/tests/functional2/testlib/test_terminal_code_eater.py index 89f4e70f0..cfb3568eb 100644 --- a/tests/functional2/testlib/test_terminal_code_eater.py +++ b/tests/functional2/testlib/test_terminal_code_eater.py @@ -1,4 +1,4 @@ -from functional2.testlib.terminal_code_eater import eat_terminal_codes +from testlib.terminal_code_eater import eat_terminal_codes def test_eats_color(): diff --git a/tests/functional2/testlib/test_utils.py b/tests/functional2/testlib/test_utils.py index d257e39c4..970186bbd 100644 --- a/tests/functional2/testlib/test_utils.py +++ b/tests/functional2/testlib/test_utils.py @@ -2,7 +2,7 @@ from collections.abc import Callable, Generator from typing import Literal, Any import pytest -from functional2.testlib.utils import is_value_of_type +from testlib.utils import is_value_of_type def test_list_type_valid(): diff --git a/tests/functional2/testlib/utils.py b/tests/functional2/testlib/utils.py index 6f9b83b6b..40ff40dac 100644 --- a/tests/functional2/testlib/utils.py +++ b/tests/functional2/testlib/utils.py @@ -6,8 +6,8 @@ from textwrap import dedent from types import UnionType from typing import Any, Literal, get_args, get_origin -from functional2.testlib.environ import environ -from functional2.testlib.fixtures.file_helper import ( +from testlib.environ import environ +from testlib.fixtures.file_helper import ( CopyFile, CopyTree, FileDeclaration, @@ -53,12 +53,7 @@ def get_functional2_files(additional_files: FileDeclaration | None = None) -> Fi if additional_files is None: additional_files = {} return merge_file_declaration( - { - "functional2": { - "__init__.py": CopyFile(functional2_base_folder / "__init__.py"), - "pyproject.toml": CopyFile(functional2_base_folder / "pyproject.toml"), - } - }, + {"functional2": {"pyproject.toml": CopyFile(functional2_base_folder / "pyproject.toml")}}, additional_files, ) diff --git a/tests/functional2/testlib/xattrs.py b/tests/functional2/testlib/xattrs.py index 2e454d2b3..b914410fa 100644 --- a/tests/functional2/testlib/xattrs.py +++ b/tests/functional2/testlib/xattrs.py @@ -2,7 +2,7 @@ import xattr import pytest from pathlib import Path -from functional2.testlib.fixtures.env import ManagedEnv +from testlib.fixtures.env import ManagedEnv def has_xattrs(path: Path) -> bool: