From b037b5abab1feb12edcbfd90a844e77ee7d61e56 Mon Sep 17 00:00:00 2001 From: JSCU-CNI <121175071+JSCU-CNI@users.noreply.github.com> Date: Wed, 22 Apr 2026 11:52:15 +0200 Subject: [PATCH 1/3] shorten test names and prevent unintentional duplicate test names --- tests/conftest.py | 24 +++++++++++++ tests/filesystems/test_extfs.py | 2 +- tests/filesystems/test_ffs.py | 2 +- tests/filesystems/test_nfs.py | 2 +- tests/filesystems/test_ntfs.py | 2 +- tests/helpers/sunrpc/test_client.py | 2 +- tests/helpers/test_configutil.py | 24 ++++++++----- tests/helpers/test_fsutil.py | 2 +- tests/helpers/test_magic.py | 11 ++++-- tests/helpers/test_protobuf.py | 12 +++++-- tests/loaders/test_acquire.py | 2 +- tests/loaders/test_containerimage.py | 4 +-- tests/loaders/test_kape.py | 2 +- tests/loaders/test_nscollector.py | 2 +- tests/loaders/test_overlay2.py | 2 +- tests/loaders/test_uac.py | 6 ++-- tests/loaders/test_velociraptor.py | 2 +- tests/loaders/test_vmsupport.py | 6 ++-- tests/plugins/apps/browser/test_firefox.py | 6 ++-- tests/plugins/apps/shell/test_powershell.py | 10 ++++-- tests/plugins/child/test_docker.py | 2 +- tests/plugins/child/test_hyperv.py | 2 +- tests/plugins/child/test_lima.py | 2 +- tests/plugins/child/test_qemu.py | 2 +- tests/plugins/filesystem/ntfs/test_mft.py | 16 ++++++--- tests/plugins/os/unix/linux/test_network.py | 25 ++++++++----- tests/plugins/os/unix/linux/test_proc.py | 5 ++- tests/plugins/os/unix/linux/test_processes.py | 15 -------- tests/plugins/os/unix/linux/test_sockets.py | 2 +- tests/plugins/os/unix/test__os.py | 5 +-- tests/plugins/os/unix/test_cronjobs.py | 21 +++++++---- tests/plugins/os/unix/test_history.py | 12 ++++--- tests/plugins/os/unix/test_ips.py | 36 ++++++++++++++----- tests/plugins/os/unix/test_version.py | 24 ++++++++----- tests/plugins/os/windows/test__os.py | 30 ++++++++++------ tests/plugins/os/windows/test_amcache.py | 6 +++- tests/plugins/scrape/test_qfind.py | 2 +- tests/test_container.py | 4 +-- tests/test_filesystem.py | 4 +-- tests/test_loader.py | 2 +- tests/test_target.py | 33 +++++++++++------ tests/test_volume.py | 2 +- tests/tools/test_qfind.py | 2 +- tests/tools/test_reg.py | 32 +++++++++++++---- tests/tools/test_shell.py | 3 +- 45 files changed, 280 insertions(+), 134 deletions(-) delete mode 100644 tests/plugins/os/unix/linux/test_processes.py diff --git a/tests/conftest.py b/tests/conftest.py index faf53376bd..eacaa53b62 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ from __future__ import annotations +import ast import importlib.util import pathlib import tempfile @@ -80,6 +81,29 @@ def pytest_sessionstart(session: pytest.Session) -> None: ) break +function_names = {} + + +@pytest.hookimpl(tryfirst=True) +def pytest_pycollect_makemodule(module_path: str, parent: str) -> None: + if duplicates := find_duplicate_functions(module_path): + pytest.exit(f"duplicate functions found in module: {module_path}: {duplicates}") + + +def find_duplicate_functions(source_path: str) -> set[str]: + source_code = pathlib.Path(source_path).read_text() + tree = ast.parse(source_code, source_path) + duplicates = set() + allowlist = ("test_other", "test_all", "test_target_open", "test_loader") + + for node in ast.walk(tree): + if isinstance(node, ast.FunctionDef) and node.name.startswith("test_") and node.name not in allowlist: + if node.name in function_names: + duplicates.add(node.name) + else: + function_names[node.name] = node + return duplicates + def pytest_runtest_setup(item: pytest.Item) -> None: if not HAS_BENCHMARK and item.get_closest_marker("benchmark") is not None: diff --git a/tests/filesystems/test_extfs.py b/tests/filesystems/test_extfs.py index 6854ea593d..2ebdd84792 100644 --- a/tests/filesystems/test_extfs.py +++ b/tests/filesystems/test_extfs.py @@ -10,7 +10,7 @@ from tests._utils import absolute_path -def test_stat_information() -> None: +def test_extfs_stat_information() -> None: extfs = Mock(block_size=0x1000) extfs.sb.s_inode_size = 129 diff --git a/tests/filesystems/test_ffs.py b/tests/filesystems/test_ffs.py index 252875f445..55546be8af 100644 --- a/tests/filesystems/test_ffs.py +++ b/tests/filesystems/test_ffs.py @@ -51,7 +51,7 @@ def ffs_fs_entry(ffs_fs: FfsFilesystem) -> FfsFilesystemEntry: return FfsFilesystemEntry(ffs_fs, "/some_file", inode) -def test_jffs2_stat(ffs_fs_entry: FfsFilesystemEntry) -> None: +def test_ffs_stat(ffs_fs_entry: FfsFilesystemEntry) -> None: stat = ffs_fs_entry.stat() entry = ffs_fs_entry.entry diff --git a/tests/filesystems/test_nfs.py b/tests/filesystems/test_nfs.py index 9b9b89b0df..81319579fb 100644 --- a/tests/filesystems/test_nfs.py +++ b/tests/filesystems/test_nfs.py @@ -99,7 +99,7 @@ def test_is_symlink(nfs_filesystem_entry: NfsFilesystemEntry) -> None: assert nfs_filesystem_entry.is_symlink() -def test_readlink(nfs_filesystem_entry: NfsFilesystemEntry, mock_nfs_client: MagicMock) -> None: +def test_nfs_readlink(nfs_filesystem_entry: NfsFilesystemEntry, mock_nfs_client: MagicMock) -> None: mock_nfs_client.readlink.return_value = "/target" target = nfs_filesystem_entry.readlink() mock_nfs_client.readlink.assert_called_with(FileHandle(opaque=b"file_handle")) diff --git a/tests/filesystems/test_ntfs.py b/tests/filesystems/test_ntfs.py index 94306eaf56..0f229a8528 100644 --- a/tests/filesystems/test_ntfs.py +++ b/tests/filesystems/test_ntfs.py @@ -77,7 +77,7 @@ def test_ntfs_unknown_file() -> None: (0x1000, 0x2000, True, 0), ], ) -def test_stat_information(cluster_size: int, size: int, resident: bool, expected_blks: int) -> None: +def test_ntfs_stat_information(cluster_size: int, size: int, resident: bool, expected_blks: int) -> None: ntfs = Mock(cluster_size=cluster_size) entry = MftRecord() diff --git a/tests/helpers/sunrpc/test_client.py b/tests/helpers/sunrpc/test_client.py index 5241e1bcb3..b81892fbf2 100644 --- a/tests/helpers/sunrpc/test_client.py +++ b/tests/helpers/sunrpc/test_client.py @@ -311,7 +311,7 @@ def test_getattr(mock_socket: MagicMock) -> None: ) -def test_readlink(mock_socket: MagicMock) -> None: +def test_sunrpc_readlink(mock_socket: MagicMock) -> None: readlink_request = b"\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\x86\xa3\x00\x00\x00\x03\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\x00\x1ccy7\xba\x00\x00\x00\x07machine\x00\x00\x00\x03\xe8\x00\x00\x03\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,\x01\x00\x07\x02\xda&\xee\x02\x00\x00\x00\x00\xb5g\x131&\xf1I\xed\xb8R\rx\\h8\xb4\x0f{\xee\x02\xefoz\xef\xda&\xee\x02'/\x00\x91" # noqa: E501 readlink_response = b"\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x01\xff\x00\x00\x00\x01\x00\x00\x03\xe8\x00\x00\x03\xe8\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Yq\x99zI\x1e5\r\x00\x00\x00\x00\x02\xee{\x0fg\xac\xba\xc3\r5\xab\xa0g\xa9\xbe\x0c:H\x15\xc0g\xa9\xbe\x0c:H\x15\xc0\x00\x00\x00\x0edir1/dir2/dir3\x00\x00" # noqa: E501 diff --git a/tests/helpers/test_configutil.py b/tests/helpers/test_configutil.py index 06ebb7dfee..0616f1f385 100644 --- a/tests/helpers/test_configutil.py +++ b/tests/helpers/test_configutil.py @@ -84,21 +84,23 @@ def test_custom_comments(comment_string: str, comment_prefixes: tuple[str, ...]) @pytest.mark.parametrize( ("indented_string", "expected_output"), [ - ( + pytest.param( """ key value1 value2 """, {"key value1": "value2"}, + id="variant-1", ), - ( + pytest.param( """ key1 value1 key2 value2 """, {"key1 value1": {"key2": "value2"}}, + id="variant-2", ), - ( + pytest.param( """ key value1 value2 @@ -106,8 +108,9 @@ def test_custom_comments(comment_string: str, comment_prefixes: tuple[str, ...]) value3 """, {"key value1": ["value2", "value3"]}, + id="variant-3", ), - ( + pytest.param( """ key value1 key2 value2a @@ -117,8 +120,9 @@ def test_custom_comments(comment_string: str, comment_prefixes: tuple[str, ...]) key3 value3b """, {"key value1": [{"key2": "value2a", "key3": "value3a"}, {"key2": "value2b", "key3": "value3b"}]}, + id="variant-4", ), - ( + pytest.param( """ key value key2 value2 @@ -128,8 +132,9 @@ def test_custom_comments(comment_string: str, comment_prefixes: tuple[str, ...]) key2 value2 """, {"key value": {"key2": "value2", "key3": "value3"}, "key value4": {"key2": "value2"}}, + id="variant-5", ), - ( + pytest.param( """ key value key2 value2 @@ -139,8 +144,9 @@ def test_custom_comments(comment_string: str, comment_prefixes: tuple[str, ...]) key2 """, {"key value": {"key2": "value2", "key3": "value3"}, "key value4": "key2"}, + id="variant-6", ), - ( + pytest.param( """ key value value2 @@ -148,6 +154,7 @@ def test_custom_comments(comment_string: str, comment_prefixes: tuple[str, ...]) key3 value3 """, {"key value": "value2", "key2 value": {"key3": "value3"}}, + id="variant-6", ), ], ) @@ -383,7 +390,7 @@ def test_env_parser(input: str | Path, expected_output: dict) -> None: @pytest.mark.parametrize( ("string_data", "expected_output"), [ - ( + pytest.param( 'default-duid "\\000\\001\\000\\001\\037\\305\\371\\341\\001\\002\\003\\004\\005\\006"\nlease {\ninterface "eth0"; # some comment\nfixed-address "1.2.3.4";\noption subnet-mask 255.255.255.0;\nrenew 2 2023/10/04 13:37:04;\n# some other comment}', # noqa: E501 { "default-duid": '"\\000\\001\\000\\001\\037\\305\\371\\341\\001\\002\\003\\004\\005\\006"', @@ -394,6 +401,7 @@ def test_env_parser(input: str | Path, expected_output: dict) -> None: "renew": "2 2023/10/04 13:37:04", }, }, + id="dhcp-lease", ), ], ) diff --git a/tests/helpers/test_fsutil.py b/tests/helpers/test_fsutil.py index 7475da28c0..016053e52c 100644 --- a/tests/helpers/test_fsutil.py +++ b/tests/helpers/test_fsutil.py @@ -1015,7 +1015,7 @@ def glob_fs() -> VirtualFilesystem: ("/", "boo/bla/*", []), ], ) -def test_glob_ext(glob_fs: VirtualFilesystem, start_path: str, pattern: str, results: list[str]) -> None: +def test_fsutil_glob_ext(glob_fs: VirtualFilesystem, start_path: str, pattern: str, results: list[str]) -> None: start_entry = glob_fs.get(start_path) entries = fsutil.glob_ext(start_entry, pattern) diff --git a/tests/helpers/test_magic.py b/tests/helpers/test_magic.py index 5effeb2990..9d68cbca4e 100755 --- a/tests/helpers/test_magic.py +++ b/tests/helpers/test_magic.py @@ -109,12 +109,19 @@ ("from_buffer", b"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1", True, "application/vnd.ms-excel"), ("from_buffer", b"Received:", True, "message/rfc822"), ("from_buffer", b"!BDN", True, "application/vnd.ms-outlook-pst"), - ("from_buffer", (b"\x00" * 2112) + b"Microsoft Word document data", True, "application/msword"), - ( + pytest.param( + "from_buffer", + (b"\x00" * 2112) + b"Microsoft Word document data", + True, + "application/msword", + id="msword", + ), + pytest.param( "from_buffer", (b"\x00" * 592) + bytes.fromhex("108d81649b4fcf1186ea00aa00b929e8"), True, "application/vnd.ms-powerpoint", + id="mspowerpoint", ), # Executables ("from_buffer", b"MZ", True, "application/x-ms-dos-executable"), diff --git a/tests/helpers/test_protobuf.py b/tests/helpers/test_protobuf.py index d3599ae7dd..a888c253f2 100644 --- a/tests/helpers/test_protobuf.py +++ b/tests/helpers/test_protobuf.py @@ -22,8 +22,16 @@ def test_protobuf_varint_decode(input: bytes, expected_output: int) -> None: @pytest.mark.parametrize( ("input", "expected_output"), [ - (1234567890, b"\xd2\x85\xd8\xcc\x04"), - (pow(2, 128), b"\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x04"), + pytest.param( + 1234567890, + b"\xd2\x85\xd8\xcc\x04", + id="1234567890", + ), + pytest.param( + pow(2, 128), + b"\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x04", + id="pow(2, 128)", + ), ], ) def test_protobuf_varint_encode(input: int, expected_output: bytes) -> None: diff --git a/tests/loaders/test_acquire.py b/tests/loaders/test_acquire.py index 38651b1fc6..b0cfd1f14d 100644 --- a/tests/loaders/test_acquire.py +++ b/tests/loaders/test_acquire.py @@ -131,7 +131,7 @@ def test_anonymous_filesystems() -> None: ], ) @pytest.mark.benchmark -def test_benchmark(benchmark: BenchmarkFixture, archive: str, loader: type[Loader]) -> None: +def test_benchmark_acquire(benchmark: BenchmarkFixture, archive: str, loader: type[Loader]) -> None: """Benchmark the loading of Acquire archives.""" file = absolute_path(archive) diff --git a/tests/loaders/test_containerimage.py b/tests/loaders/test_containerimage.py index 08755cf1a2..1f56668f87 100644 --- a/tests/loaders/test_containerimage.py +++ b/tests/loaders/test_containerimage.py @@ -32,7 +32,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == path -def test_docker() -> None: +def test_containerimage_docker() -> None: """Test if we map a Docker image correctly.""" path = absolute_path("_data/loaders/containerimage/alpine-docker.tar") @@ -75,7 +75,7 @@ def test_docker() -> None: ] -def test_oci_podman() -> None: +def test_containerimage_oci_podman() -> None: """Test if we map a Podman OCI image correctly.""" path = absolute_path("_data/loaders/containerimage/alpine-oci.tar") diff --git a/tests/loaders/test_kape.py b/tests/loaders/test_kape.py index b4128eb0da..40dcca25fa 100644 --- a/tests/loaders/test_kape.py +++ b/tests/loaders/test_kape.py @@ -51,7 +51,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_kape_dir: Path @patch("dissect.target.filesystems.dir.DirectoryFilesystem.ntfs", None, create=True) -def test_dir(mock_kape_dir: Path) -> None: +def test_dir_kape(mock_kape_dir: Path) -> None: """Test the ``KapeLoader`` with a directory.""" loader = loader_open(mock_kape_dir) assert isinstance(loader, KapeLoader) diff --git a/tests/loaders/test_nscollector.py b/tests/loaders/test_nscollector.py index 0ae9ea8923..84419322c3 100644 --- a/tests/loaders/test_nscollector.py +++ b/tests/loaders/test_nscollector.py @@ -33,7 +33,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == path -def test_compressed_tar(caplog: pytest.LogCaptureFixture) -> None: +def test_ns_compressed_tar(caplog: pytest.LogCaptureFixture) -> None: """Test if we map a compressed NetScaler Collector tar image correctly.""" path = absolute_path("_data/loaders/nscollector/collector_P_10.164.0.3_22Oct2025_11_31.tar.gz") diff --git a/tests/loaders/test_overlay2.py b/tests/loaders/test_overlay2.py index 8ec7b6c71f..edb179a766 100644 --- a/tests/loaders/test_overlay2.py +++ b/tests/loaders/test_overlay2.py @@ -39,7 +39,7 @@ def test_target_open(opener: Callable[[str | Path], Target], target_linux_docker ("f988f88e221d97930a665712cf16ab520f7e2c5af395660c145df93aebedf071", 9, 19), ], ) -def test_docker(target_linux_docker: Target, path: str, layers: int, entries: int) -> None: +def test_overlay2_docker(target_linux_docker: Target, path: str, layers: int, entries: int) -> None: """Test if we correctly detect and map a Docker container.""" container = target_linux_docker.fs.path("/var/lib/docker/image/overlay2/layerdb/mounts").joinpath(path) diff --git a/tests/loaders/test_uac.py b/tests/loaders/test_uac.py index c06b2da106..8f36e854a0 100644 --- a/tests/loaders/test_uac.py +++ b/tests/loaders/test_uac.py @@ -71,7 +71,7 @@ def test_target_open( ("_data/loaders/uac/uac-2e44ea6da71d-linux-20250717143112.tar.gz"), ], ) -def test_compressed_tar(data_path: str) -> None: +def test_uac_compressed_tar(data_path: str) -> None: """Test if we map a compressed UAC tar image correctly.""" path = absolute_path(data_path) @@ -109,7 +109,7 @@ def test_compressed_zip() -> None: assert test_file.open().readline() == b"root:x:0:0:root:/root:/bin/bash\n" -def test_dir(mock_uac_dir: Path) -> None: +def test_dir_uac(mock_uac_dir: Path) -> None: """Test if we map an extracted UAC directory correctly.""" loader = loader_open(mock_uac_dir) assert isinstance(loader, UacLoader) @@ -133,7 +133,7 @@ def test_dir(mock_uac_dir: Path) -> None: ], ) @pytest.mark.benchmark -def test_benchmark(benchmark: BenchmarkFixture, archive: str, loader: type[Loader]) -> None: +def test_benchmark_uac(benchmark: BenchmarkFixture, archive: str, loader: type[Loader]) -> None: file = absolute_path(archive) benchmark(lambda: loader(file).map(Target())) diff --git a/tests/loaders/test_velociraptor.py b/tests/loaders/test_velociraptor.py index 8ad4651679..597dd56cbe 100644 --- a/tests/loaders/test_velociraptor.py +++ b/tests/loaders/test_velociraptor.py @@ -133,7 +133,7 @@ def test_windows_ntfs_zip(mock_velociraptor_dir: Path) -> None: (["uploads/auto/Library", "uploads/auto/Applications", "uploads/auto/%2ETEST"]), ], ) -def test_unix(paths: list[str], tmp_path: Path) -> None: +def test_velo_unix(paths: list[str], tmp_path: Path) -> None: """Test that ``VelociraptorLoader`` correctly loads a Unix directory structure.""" root = tmp_path mkdirs(root, paths) diff --git a/tests/loaders/test_vmsupport.py b/tests/loaders/test_vmsupport.py index 10fb92df1b..cf7e4b24ec 100644 --- a/tests/loaders/test_vmsupport.py +++ b/tests/loaders/test_vmsupport.py @@ -69,7 +69,7 @@ def test_target_open( "_data/loaders/vmsupport/esx-localhost8-2026-01-09--16.04-135806.tgz", ], ) -def test_compressed_tar(data_path: str) -> None: +def test_vmsupport_compressed_tar(data_path: str) -> None: """Test if we map a compressed vm support tar image correctly.""" path = absolute_path(data_path) @@ -88,7 +88,7 @@ def test_compressed_tar(data_path: str) -> None: assert b"/resourceGroups/version" in test_file.open().read() -def test_dir(mock_vmsupport_dir: Path) -> None: +def test_dir_vmsupport(mock_vmsupport_dir: Path) -> None: """Test if we map an extracted vm support directory correctly.""" loader = loader_open(mock_vmsupport_dir) assert isinstance(loader, VmSupportLoader) @@ -112,7 +112,7 @@ def test_dir(mock_vmsupport_dir: Path) -> None: ], ) @pytest.mark.benchmark -def test_benchmark(benchmark: BenchmarkFixture, archive: str, loader: type[Loader]) -> None: +def test_benchmark_vmsupport(benchmark: BenchmarkFixture, archive: str, loader: type[Loader]) -> None: file = absolute_path(archive) benchmark(lambda: loader(file).map(Target())) diff --git a/tests/plugins/apps/browser/test_firefox.py b/tests/plugins/apps/browser/test_firefox.py index 8545131f01..07c7a92f37 100644 --- a/tests/plugins/apps/browser/test_firefox.py +++ b/tests/plugins/apps/browser/test_firefox.py @@ -58,13 +58,15 @@ def target_firefox_oculus(target_android: Target, fs_android: VirtualFilesystem) @pytest.mark.parametrize( ("target_platform", "expected_source"), [ - ( + pytest.param( "target_firefox_win", "C:\\Users\\John\\AppData\\local\\Mozilla\\Firefox\\Profiles\\g1rbw8y7.default-release\\places.sqlite", + id="windows", ), - ( + pytest.param( "target_firefox_unix", "/root/.mozilla/firefox/g1rbw8y7.default-release/places.sqlite", + id="unix", ), ], ) diff --git a/tests/plugins/apps/shell/test_powershell.py b/tests/plugins/apps/shell/test_powershell.py index c1cbcbf29f..5e7fa39f35 100644 --- a/tests/plugins/apps/shell/test_powershell.py +++ b/tests/plugins/apps/shell/test_powershell.py @@ -9,12 +9,18 @@ @pytest.mark.parametrize( ("target", "fs", "target_file"), [ - ( + pytest.param( "target_win_users", "fs_win", "users\\John\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\psreadline\\ConsoleHost_history.txt", + id="windows", + ), + pytest.param( + "target_unix_users", + "fs_unix", + "/root/.local/share/powershell/PSReadLine/ConsoleHost_history.txt", + id="unix", ), - ("target_unix_users", "fs_unix", "/root/.local/share/powershell/PSReadLine/ConsoleHost_history.txt"), ], ) def test_powershell(target: str, fs: str, target_file: str, request: pytest.FixtureRequest) -> None: diff --git a/tests/plugins/child/test_docker.py b/tests/plugins/child/test_docker.py index 48f6caddd1..9e5116de20 100644 --- a/tests/plugins/child/test_docker.py +++ b/tests/plugins/child/test_docker.py @@ -8,7 +8,7 @@ from dissect.target.target import Target -def test_docker(target_linux_docker: Target) -> None: +def test_docker_child(target_linux_docker: Target) -> None: target_linux_docker.add_plugin(DockerChildTargetPlugin) children = sorted([child for _, child in target_linux_docker.list_children()], key=lambda r: r.path) diff --git a/tests/plugins/child/test_hyperv.py b/tests/plugins/child/test_hyperv.py index 3e0cd37830..c2aa802cfc 100644 --- a/tests/plugins/child/test_hyperv.py +++ b/tests/plugins/child/test_hyperv.py @@ -10,7 +10,7 @@ from dissect.target.target import Target -def test_wsl(target_win: Target, fs_win: VirtualFilesystem) -> None: +def test_hyperv(target_win: Target, fs_win: VirtualFilesystem) -> None: fs_win.map_file( "ProgramData/Microsoft/Windows/Hyper-V/data.vmcx", absolute_path("_data/plugins/child/hyperv/data.vmcx"), diff --git a/tests/plugins/child/test_lima.py b/tests/plugins/child/test_lima.py index 8bc8723755..116c2d0483 100644 --- a/tests/plugins/child/test_lima.py +++ b/tests/plugins/child/test_lima.py @@ -10,7 +10,7 @@ from dissect.target.target import Target -def test_child_colima(target_unix_users: Target, fs_unix: VirtualFilesystem) -> None: +def test_child_lima(target_unix_users: Target, fs_unix: VirtualFilesystem) -> None: fs_unix.map_file_fh("/root/.lima/default/diffdisk", BytesIO()) fs_unix.map_file_fh("/root/.lima/docker/diffdisk", BytesIO()) fs_unix.map_file_fh("/home/user/.config/lima/ligma/diffdisk", BytesIO()) diff --git a/tests/plugins/child/test_qemu.py b/tests/plugins/child/test_qemu.py index 3331090ef5..e1131986da 100644 --- a/tests/plugins/child/test_qemu.py +++ b/tests/plugins/child/test_qemu.py @@ -24,7 +24,7 @@ def test_compatible(target_linux: Target, fs_linux: VirtualFilesystem) -> None: QemuChildTargetPlugin(target_linux).check_compatible() -def test_list_children(target_linux: Target, fs_linux: VirtualFilesystem) -> None: +def test_qemu_children(target_linux: Target, fs_linux: VirtualFilesystem) -> None: qemu_xml = absolute_path("_data/loaders/libvirt/qemu.xml") fs_linux.map_file("/etc/libvirt/qemu/linux2022.xml", qemu_xml) fs_linux.map_file("/etc/libvirt/qemu/linux2024.xml", qemu_xml) diff --git a/tests/plugins/filesystem/ntfs/test_mft.py b/tests/plugins/filesystem/ntfs/test_mft.py index 58f264299f..9ac8dc03cf 100644 --- a/tests/plugins/filesystem/ntfs/test_mft.py +++ b/tests/plugins/filesystem/ntfs/test_mft.py @@ -110,7 +110,12 @@ def test_get_owner_and_group_none_attr() -> None: @pytest.mark.parametrize( ("guid", "serial", "expected_result"), [ - ("7dc1a62c-c488-47c5-8eab-09240f38894e", 0x9E0C158A4CE55327, "7dc1a62c-c488-47c5-8eab-09240f38894e"), + pytest.param( + "7dc1a62c-c488-47c5-8eab-09240f38894e", + 0x9E0C158A4CE55327, + "7dc1a62c-c488-47c5-8eab-09240f38894e", + id="7dc1a62c-c488-47c5-8eab-09240f38894e", + ), (None, 0x2B4A7D188A9163F2, "3119443236264961010"), ("", None, None), (None, None, None), @@ -147,20 +152,23 @@ def test_volume_identifier_none_guid() -> None: (r".+Size:(No Data)", 120), (r".+Is_ADS$", 24), (r".+Size:\d+", 184), - ( + pytest.param( r"2021-08-04 ([+.:]?\d+)+ [SF]0?[BCMA] 43 NamelessDirectory - " r"In[uU]se:True Resident:No Data Owner:No Data Size:No Data VolumeUUID:No Data", 8, + id="namelessdir-1", ), - ( + pytest.param( r"2021-08-04 ([+.:]?\d+)+ [SF]0?[BCMA] 46 NamelessDirectory\\totally_normal.txt - " r"In[uU]se:True Resident:True Owner:No Data Size:28 VolumeUUID:No Data", 8, + id="namelessdir-2", ), - ( + pytest.param( r"2021-08-04 ([+.:]?\d+)+ [SF]0?[BCMA] 46 NamelessDirectory\\totally_normal.txt" r":secret_text.txt - InUse:True Resident:True Owner:No Data Size:24 VolumeUUID:No Data Is_ADS", 4, + id="namelessdir-3", ), ], ) diff --git a/tests/plugins/os/unix/linux/test_network.py b/tests/plugins/os/unix/linux/test_network.py index 9f51d41e95..e315b7a81b 100644 --- a/tests/plugins/os/unix/linux/test_network.py +++ b/tests/plugins/os/unix/linux/test_network.py @@ -334,7 +334,7 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - @pytest.mark.parametrize( ("expected_record", "messages"), [ - ( + pytest.param( { "name": "eth0", "cidr": [ip_interface("10.13.37.1/32")], @@ -342,8 +342,9 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "source": "syslog", }, "Jan 1 13:37:01 hostname NetworkManager[1]: [1600000000.0000] dhcp4 (eth0): option ip_address => '10.13.37.1'", # noqa: E501 + id="networkmanager-dhcp4-option-addr", ), - ( + pytest.param( { "name": "eth0", "cidr": [ip_interface("10.13.37.1/32")], @@ -351,8 +352,9 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "source": "syslog", }, "Jan 1 13:37:01 hostname NetworkManager[2]: [1600000000.0000] dhcp4 (eth0): state changed new lease, address=10.13.37.1", # noqa: E501 + id="networkmanager-dhcp4-new-lease", ), - ( + pytest.param( { "name": "eth0", "cidr": [ip_interface("10.13.37.1/32")], @@ -360,8 +362,9 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "source": "syslog", }, "Jan 1 13:37:01 hostname NetworkManager[2]: [1600000000.0000] dhcp4 (eth0): state changed new lease, address=10.13.37.1, acd pending", # noqa: E501 + id="networkmanager-dhcp4-pending", ), - ( + pytest.param( { "name": "eth0", "cidr": [ip_interface("10.13.37.2/24")], @@ -369,8 +372,9 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "source": "syslog", }, "Feb 2 13:37:02 test systemd-networkd[3]: eth0: DHCPv4 address 10.13.37.2/24 via 10.13.37.0", + id="networkd-dhcpv4-addr", ), - ( + pytest.param( { "name": "eth0", "cidr": [ip_interface("10.13.37.3/32")], @@ -378,8 +382,9 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "source": "syslog", }, "Mar 3 13:37:03 localhost NetworkManager[4]: [1600000000.0003] dhcp4 (eth0): address 10.13.37.3", + id="networkmanager-dhcp4-addr-variant", ), - ( + pytest.param( { "name": None, "cidr": [ip_interface("10.13.37.4/32")], @@ -387,8 +392,9 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "source": "syslog", }, "Apr 4 13:37:04 localhost dhclient[5]: bound to 10.13.37.4 -- renewal in 1337 seconds.", + id="dhclient-bound-to-addr", ), - ( + pytest.param( { "name": "eth0", "cidr": [ip_interface("2001:db8::/64")], @@ -399,10 +405,13 @@ def test_proc_config_parser(target_linux: Target, fs_linux: VirtualFilesystem) - "Jun 6 13:37:06 test systemd-networkd[6]: eth0: DHCPv6 address 2001:db8::/64 via 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff\n" # noqa: E501 "May 5 13:37:05 test systemd-networkd[6]: eth0: DHCPv6 lease lost\n" ), + id="networkd-dhcpv6-addr", ), ], ) -def test_ips_dhcp(target_unix_users: Target, fs_unix: VirtualFilesystem, expected_record: dict, messages: str) -> None: +def test_network_ips_dhcp( + target_unix_users: Target, fs_unix: VirtualFilesystem, expected_record: dict, messages: str +) -> None: """Test DHCP lease messages from /var/log/syslog.""" fs_unix.map_file_fh( "/var/log/syslog", diff --git a/tests/plugins/os/unix/linux/test_proc.py b/tests/plugins/os/unix/linux/test_proc.py index 475aa232a0..64d3e16d7f 100644 --- a/tests/plugins/os/unix/linux/test_proc.py +++ b/tests/plugins/os/unix/linux/test_proc.py @@ -41,7 +41,10 @@ def test_process_not_found(target_linux_users: Target, fs_linux_proc: VirtualFil def test_processes(target_linux_users: Target, fs_linux_proc: VirtualFilesystem) -> None: target_linux_users.add_plugin(ProcPlugin) - for process in target_linux_users.proc.processes(): + results = list(target_linux_users.proc.processes()) + assert len(results) == 4 + + for process in results: assert process.pid in (1, 2, 3, 1337) assert process.state in ("Sleeping", "Waking", "Running", "Wakekill") assert process.name in ("systemd", "kthread", "acquire", "sshd") diff --git a/tests/plugins/os/unix/linux/test_processes.py b/tests/plugins/os/unix/linux/test_processes.py deleted file mode 100644 index 895e56d969..0000000000 --- a/tests/plugins/os/unix/linux/test_processes.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import annotations - -from typing import TYPE_CHECKING - -from dissect.target.plugins.os.unix.linux.proc import ProcPlugin - -if TYPE_CHECKING: - from dissect.target.filesystem import VirtualFilesystem - from dissect.target.target import Target - - -def test_processes(target_linux_users: Target, fs_linux_proc: VirtualFilesystem) -> None: - target_linux_users.add_plugin(ProcPlugin) - results = list(target_linux_users.processes()) - assert len(results) == 4 diff --git a/tests/plugins/os/unix/linux/test_sockets.py b/tests/plugins/os/unix/linux/test_sockets.py index 9aca407500..d4fc0acdeb 100644 --- a/tests/plugins/os/unix/linux/test_sockets.py +++ b/tests/plugins/os/unix/linux/test_sockets.py @@ -134,7 +134,7 @@ def test_packet(target_linux_users: Target, fs_linux_proc_sockets: VirtualFilesy assert result.owner == "root" -def test_unix(target_linux_users: Target, fs_linux_proc_sockets: VirtualFilesystem) -> None: +def test_sockets_unix(target_linux_users: Target, fs_linux_proc_sockets: VirtualFilesystem) -> None: target_linux_users.add_plugin(ProcPlugin) target_linux_users.add_plugin(NetSocketPlugin) results = list(target_linux_users.sockets.unix()) diff --git a/tests/plugins/os/unix/test__os.py b/tests/plugins/os/unix/test__os.py index 18e970683d..94c84a4070 100644 --- a/tests/plugins/os/unix/test__os.py +++ b/tests/plugins/os/unix/test__os.py @@ -145,11 +145,12 @@ def test_parse_domain( [ ("/etc/hostname", "myhost", "mydomain.com", b"myhost.mydomain.com"), ("/etc/HOSTNAME", "myhost", "mydomain.com", b"myhost.mydomain.com"), - ( + pytest.param( "/etc/sysconfig/network", "myhost", "mydomain.com", b"NETWORKING=NO\nHOSTNAME=myhost.mydomain.com\nGATEWAY=192.168.1.1", + id="hostname-fqdn", ), ("/etc/hostname", "myhost", None, b"myhost"), ("/etc/sysconfig/network", "myhost", None, b"NETWORKING=NO\nHOSTNAME=myhost\nGATEWAY=192.168.1.1"), @@ -175,7 +176,7 @@ def test_parse_hostname_string( assert domain == expected_domain, f"Expected domain {expected_domain!r} but got {domain!r}" -def test_users(target_unix_users: Target) -> None: +def test_unix_users(target_unix_users: Target) -> None: users = list(target_unix_users.users()) assert len(users) == 3 diff --git a/tests/plugins/os/unix/test_cronjobs.py b/tests/plugins/os/unix/test_cronjobs.py index fc0d321e4c..ac958c3bee 100644 --- a/tests/plugins/os/unix/test_cronjobs.py +++ b/tests/plugins/os/unix/test_cronjobs.py @@ -70,7 +70,7 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N @pytest.mark.parametrize( ("cron_line", "expected_output", "expected_user"), [ - ( + pytest.param( "0 0 * * * FOO=bar /path/to/some/script.sh", { "command": "FOO=bar /path/to/some/script.sh", @@ -82,8 +82,9 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, None, + id="variant-1", ), - ( + pytest.param( "0 * * * * source some-file ; /path/to/some/script.sh", { "command": "source some-file ; /path/to/some/script.sh", @@ -95,8 +96,9 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, None, + id="variant-2", ), - ( + pytest.param( r"0 0 * * * sleep ${RANDOM:0:1} && /path/to/executable", { "command": r"sleep ${RANDOM:0:1} && /path/to/executable", @@ -108,8 +110,9 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, None, + id="variant-3", ), - ( + pytest.param( "*/5 * * * * /bin/bash -c 'source /some-file; echo \"FOO: $BAR\" >> /var/log/some.log 2>&1'", { "command": "/bin/bash -c 'source /some-file; echo \"FOO: $BAR\" >> /var/log/some.log 2>&1'", @@ -121,8 +124,9 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, None, + id="variant-4", ), - ( + pytest.param( "0 0 * * * example.sh", { "command": "example.sh", @@ -134,8 +138,9 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, None, + id="variant-4", ), - ( + pytest.param( "0 0 * * * root example.sh", { "command": "root example.sh", @@ -147,8 +152,9 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, "root", + id="variant-5", ), - ( + pytest.param( "0 0 * * * root\texample.sh", { "command": "example.sh", @@ -160,6 +166,7 @@ def test_unix_cronjobs_env(target_unix: Target, fs_unix: VirtualFilesystem) -> N "weekday": "*", }, "root", + id="variant-6", ), ], ) diff --git a/tests/plugins/os/unix/test_history.py b/tests/plugins/os/unix/test_history.py index c155bb132d..8fb3b47e8b 100644 --- a/tests/plugins/os/unix/test_history.py +++ b/tests/plugins/os/unix/test_history.py @@ -171,7 +171,7 @@ def test_commandhistory_fish_history(target_unix_users: Target, fs_unix: Virtual @pytest.mark.parametrize( ("db_type", "db_file", "db_history"), [ - ( + pytest.param( "mongodb", ".dbshell", """ @@ -179,8 +179,9 @@ def test_commandhistory_fish_history(target_unix_users: Target, fs_unix: Virtual print("Hello World") db.users.find({ name: /foo/i }, { _id: 0, name: 1}) """, + id="mongodb", ), - ( + pytest.param( "postgresql", ".psql_history", """ @@ -189,8 +190,9 @@ def test_commandhistory_fish_history(target_unix_users: Target, fs_unix: Virtual \\dt select * from users; """, + id="postgresql", ), - ( + pytest.param( "mysql", ".mysql_history", """ @@ -199,8 +201,9 @@ def test_commandhistory_fish_history(target_unix_users: Target, fs_unix: Virtual show tables; select * from users; """, + id="mysql", ), - ( + pytest.param( "sqlite", ".sqlite_history", """ @@ -210,6 +213,7 @@ def test_commandhistory_fish_history(target_unix_users: Target, fs_unix: Virtual insert into tbl1 values('goodbye', 20); select * from tbl1; """, + id="sqlite", ), ], ) diff --git a/tests/plugins/os/unix/test_ips.py b/tests/plugins/os/unix/test_ips.py index b80dac1ae4..5123dcbf3c 100644 --- a/tests/plugins/os/unix/test_ips.py +++ b/tests/plugins/os/unix/test_ips.py @@ -21,25 +21,33 @@ @pytest.mark.parametrize( ("expected_ips", "messages"), [ - ( + pytest.param( ["10.13.37.1"], "Jan 1 13:37:01 hostname NetworkManager[1]: [1600000000.0000] dhcp4 (eth0): option ip_address => '10.13.37.1'", # noqa: E501 + id="networkmanager-dhcp4-option", ), - (["10.13.37.2"], "Feb 2 13:37:02 test systemd-networkd[2]: eth0: DHCPv4 address 10.13.37.2/24 via 10.13.37.0"), - ( + pytest.param( + ["10.13.37.2"], + "Feb 2 13:37:02 test systemd-networkd[2]: eth0: DHCPv4 address 10.13.37.2/24 via 10.13.37.0", + id="systemd-dhcpv4-address-via", + ), + pytest.param( ["10.13.37.3"], "Mar 3 13:37:03 localhost NetworkManager[3]: [1600000000.0003] dhcp4 (eth0): address 10.13.37.3", + id="networkmanager-dhcpv4-address", ), - ( + pytest.param( ["10.13.37.4"], "Apr 4 13:37:04 localhost dhclient[4]: bound to 10.13.37.4 -- renewal in 1337 seconds.", + id="dhclient-bound-to", ), - ( + pytest.param( ["2001:db8::"], ( "Jun 6 13:37:06 test systemd-networkd[5]: eth0: DHCPv6 address 2001:db8::/64 via 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff\n" # noqa: E501 "May 5 13:37:05 test systemd-networkd[5]: eth0: DHCPv6 lease lost\n" ), + id="dhcpv6-ipv6", ), ], ) @@ -180,9 +188,21 @@ def test_ips_netplan_static(target_unix_users: Target, fs_unix: VirtualFilesyste ("network:", []), ("network:\n ethernets:\n", []), ("network:\n ethernets:\n eth0:\n", []), - ("network:\n ethernets:\n eth0:\n addresses: []\n", []), - ("network:\n ethernets:\n eth0:\n addresses: [1.2.3.4/24]\n", ["1.2.3.4"]), - ("network:\n ethernets:\n eth0:\n addresses: ['1.2.3.4']\n", ["1.2.3.4"]), + pytest.param( + "network:\n ethernets:\n eth0:\n addresses: []\n", + [], + id="empty-list", + ), + pytest.param( + "network:\n ethernets:\n eth0:\n addresses: [1.2.3.4/24]\n", + ["1.2.3.4"], + id="cidr-24", + ), + pytest.param( + "network:\n ethernets:\n eth0:\n addresses: ['1.2.3.4']\n", + ["1.2.3.4"], + id="no-cidr", + ), ], ) def test_ips_netplan_static_invalid( diff --git a/tests/plugins/os/unix/test_version.py b/tests/plugins/os/unix/test_version.py index 8e97300140..3766f7a643 100644 --- a/tests/plugins/os/unix/test_version.py +++ b/tests/plugins/os/unix/test_version.py @@ -18,53 +18,61 @@ @pytest.mark.parametrize( ("data_path", "target_path", "expected_version", "os_plugin"), [ - ( + pytest.param( "_data/plugins/os/unix/linux/debian/_os/debian-os-release", "/etc/os-release", "Debian GNU/Linux 11 (bullseye)", LinuxPlugin, + id="debian-11", ), - ( + pytest.param( "_data/plugins/os/unix/linux/debian/_os/ubuntu-os-release", "/etc/os-release", "Ubuntu 22.04.2 LTS (Jammy Jellyfish)", LinuxPlugin, + id="ubuntu-22", ), - ( + pytest.param( "_data/plugins/os/unix/linux/redhat/_os/centos-os-release", "/etc/os-release", "CentOS Linux 8", LinuxPlugin, + id="centos-8", ), - ( + pytest.param( "_data/plugins/os/unix/linux/redhat/_os/fedora-os-release", "/etc/os-release", "Fedora Linux 37 (Container Image)", LinuxPlugin, + id="fedora-37", ), - ( + pytest.param( "_data/plugins/os/unix/linux/suse/_os/opensuse-os-release", "/etc/os-release", "openSUSE Leap 15.4", LinuxPlugin, + id="opensuse-leap-15", ), - ( + pytest.param( "_data/plugins/os/unix/linux/debian/_os/ubuntu-lsb-release", "/etc/lsb-release", "Ubuntu 22.04.2 LTS", LinuxPlugin, + id="ubuntu-22-lsb", ), - ( + pytest.param( "_data/plugins/os/unix/bsd/freebsd/_os/freebsd-freebsd-version", "/bin/freebsd-version", "13.0-RELEASE", FreeBsdPlugin, + id="freebsd-13", ), - ( + pytest.param( "_data/plugins/os/unix/linux/alpine/_os/alpine-os-release", "/etc/os-release", "Alpine Linux 3.18.4", LinuxPlugin, + id="alpine-3.18", ), ], ) diff --git a/tests/plugins/os/windows/test__os.py b/tests/plugins/os/windows/test__os.py index 58e760663f..4df7b609df 100644 --- a/tests/plugins/os/windows/test__os.py +++ b/tests/plugins/os/windows/test__os.py @@ -156,7 +156,7 @@ def test_windowsplugin__nt_version( ("keys", "value"), [ ([], None), - ( + pytest.param( [ ("CSDVersion", 5678), ("CurrentBuildNumber", 1234), @@ -167,8 +167,9 @@ def test_windowsplugin__nt_version( ("UBR", 9012), ], "Some Product (NT 10.0) 1234.9012 5678", + id="major-minor", ), - ( + pytest.param( [ ("CSDVersion", 5678), ("CurrentBuildNumber", 1234), @@ -177,46 +178,53 @@ def test_windowsplugin__nt_version( ("UBR", 9012), ], "Some Product (NT x.y) 1234.9012 5678", + id="current-version", ), - ( + pytest.param( [ ("CurrentBuildNumber", 1234), ("CurrentVersion", "x.y"), ("ProductName", "Some Product"), ], "Some Product (NT x.y) 1234", + id="bare-version", ), - ( + pytest.param( [ ("ProductName", "Some Product"), ], "Some Product (NT ) ", + id="only-product", ), - ( + pytest.param( [ ("CurrentVersion", "x.y"), ], " (NT x.y) ", + id="only-version", ), - ( + pytest.param( [ ("CurrentBuildNumber", 1234), ], " (NT ) 1234", + id="only-build", ), - ( + pytest.param( [ ("UBR", 9012), ], " (NT ) .9012", + id="only-ubr", ), - ( + pytest.param( [ ("CSDVersion", 5678), ], " (NT ) 5678", + id="only-csd", ), - ( + pytest.param( [ ("ProductName", "Windows 10 Pro"), ("CurrentMajorVersionNumber", 10), @@ -225,8 +233,9 @@ def test_windowsplugin__nt_version( ("UBR", 1234), ], "Windows 10 Pro (NT 10.0) 19045.1234", + id="win-10-pro", ), - ( + pytest.param( [ ("ProductName", "Windows 10 Enterprise"), ("CurrentMajorVersionNumber", 10), @@ -235,6 +244,7 @@ def test_windowsplugin__nt_version( ("UBR", 1234), ], "Windows 11 Enterprise (NT 10.0) 22000.1234", + id="win-11-enterprise", ), ], ) diff --git a/tests/plugins/os/windows/test_amcache.py b/tests/plugins/os/windows/test_amcache.py index 8c433065d3..4fb4df565a 100644 --- a/tests/plugins/os/windows/test_amcache.py +++ b/tests/plugins/os/windows/test_amcache.py @@ -156,7 +156,11 @@ def mock_read_key_subkeys(self: AmcachePlugin, key: str) -> Iterator[Mock]: @pytest.mark.parametrize( ("test_file_id", "expected_file_id"), [ - ("00008e01cdeb9a1c23cee421a647f29c45f67623be97", "8e01cdeb9a1c23cee421a647f29c45f67623be97"), + pytest.param( + "00008e01cdeb9a1c23cee421a647f29c45f67623be97", + "8e01cdeb9a1c23cee421a647f29c45f67623be97", + id="file-id", + ), ("", None), (None, None), ], diff --git a/tests/plugins/scrape/test_qfind.py b/tests/plugins/scrape/test_qfind.py index ceb9db0b0f..384d267888 100644 --- a/tests/plugins/scrape/test_qfind.py +++ b/tests/plugins/scrape/test_qfind.py @@ -35,7 +35,7 @@ def mock_target(target_bare: Target) -> Target: return target_bare -def test_qfind(mock_target: Target) -> None: +def test_qfind_scrape(mock_target: Target) -> None: """Test if qfind can find a simple short needle.""" results = list(mock_target.qfind(["B"])) diff --git a/tests/test_container.py b/tests/test_container.py index a30e93ff5a..72f029622c 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -79,7 +79,7 @@ def test_open_fallback_fh(tmp_path: Path) -> None: assert not vhd.VhdContainer.detect(tmp_dummy) -def test_reset_file_position() -> None: +def test_container_reset_file_position() -> None: fh = BytesIO(b"\x00" * 8192) fh.seek(512) @@ -104,7 +104,7 @@ def _detect_fh(fh: BinaryIO, *args, **kwargs) -> bool: assert fh.tell() == 512 -def test_registration(tmp_path: Path) -> None: +def test_container_registration(tmp_path: Path) -> None: code = """ from __future__ import annotations diff --git a/tests/test_filesystem.py b/tests/test_filesystem.py index 098e87f2fd..ac79a11f65 100644 --- a/tests/test_filesystem.py +++ b/tests/test_filesystem.py @@ -68,7 +68,7 @@ def vfs() -> VirtualFilesystem: return vfs -def test_registration(tmp_path: Path) -> None: +def test_filesystem_registration(tmp_path: Path) -> None: code = """ from __future__ import annotations @@ -1179,7 +1179,7 @@ def test_mapped_file_readlink(vfs: VirtualFilesystem) -> None: MappedFile(vfs, "/guestlink", "/hostlink").readlink_ext() -def test_reset_file_position() -> None: +def test_filesystem_reset_file_position() -> None: fh = BytesIO(b"\x00" * 8192) fh.seek(512) diff --git a/tests/test_loader.py b/tests/test_loader.py index 3f7880eca5..7229b7d059 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -10,7 +10,7 @@ from pathlib import Path -def test_registration(tmp_path: Path) -> None: +def test_loader_registration(tmp_path: Path) -> None: code = """ from pathlib import Path diff --git a/tests/test_target.py b/tests/test_target.py index 9816c3a3fa..a2ff8613e6 100644 --- a/tests/test_target.py +++ b/tests/test_target.py @@ -43,37 +43,40 @@ def error(*args, **kwargs) -> None: [ # Base cases: # Scenario 0: Can we still load a single target that's not a dir? - ( + pytest.param( [ "/raw.tst", ], "/raw.tst", "[TestLoader('/raw.tst')]", 0, + id="single-target-no-dir", ), # Scenario 0b: Make sure we still get so see errors if a target fails to load # (1 error + 1 exception no load) - ( + pytest.param( [ "/raw.vbox", ], "/raw.vbox", "[]", 2, + id="no-target-ensure-errors", ), # Scenario 0c: Attempting to load a dir with nothing of interest yield an error # (1 exception no load) - ( + pytest.param( [ "/dir/garbage", ], "/dir", "[]", 1, + id="target-dir-empty", ), # Dir cases: # Scenario 1: Dir is loadable target (simple) - ( + pytest.param( [ "/dir/etc", "/dir/var", @@ -81,9 +84,10 @@ def error(*args, **kwargs) -> None: "/dir", "[DirLoader('/dir')]", 0, + id="target-dir-simple", ), # Scenario 2: dir contains multiple loadable targets - ( + pytest.param( [ "/dir/raw.img", "/dir/raw2.tst", @@ -91,10 +95,11 @@ def error(*args, **kwargs) -> None: "/dir", "[RawLoader('/dir/raw.img'), TestLoader('/dir/raw2.tst')]", 0, + id="multiple-targets-dir", ), # Scenario 2b: dir contains multiple loadable targets and some garbage # (it will wrap the garbage in a RawLoader to try) - ( + pytest.param( [ "/dir/raw.img", "/dir/raw2.tst", @@ -103,9 +108,10 @@ def error(*args, **kwargs) -> None: "/dir", "[RawLoader('/dir/raw.img'), TestLoader('/dir/raw2.tst'), RawLoader('/dir/info.txt')]", 0, + id="multiple-targets-dir-one-garbage", ), # Scenario 3: dir contains 1 loadable dir as well as 2 loadable targets - ( + pytest.param( [ "/dir/unix/etc", "/dir/unix/var", @@ -115,9 +121,10 @@ def error(*args, **kwargs) -> None: "/dir", "[DirLoader('/dir/unix'), RawLoader('/dir/raw.img'), TestLoader('/dir/raw2.tst')]", 0, + id="one-dir-multiple-targets", ), # Scenario 3b: dir contains 2 loadable dirs as well as 2 loadable targets - ( + pytest.param( [ "/dir/unix/etc", "/dir/unix/var", @@ -129,9 +136,10 @@ def error(*args, **kwargs) -> None: "/dir", "[DirLoader('/dir/unix'), DirLoader('/dir/win'), RawLoader('/dir/raw.img'), TestLoader('/dir/raw2.tst')]", 0, + id="multiple-dirs-multiple-targets", ), # Scenario 4: dir is a loadable dir but contains other files including loadable targets - ( + pytest.param( [ "/dir/etc", "/dir/var", @@ -141,9 +149,10 @@ def error(*args, **kwargs) -> None: "/dir", "[DirLoader('/dir')]", 0, + id="loadable-dir-other-files-and-targets", ), # Scenario 4b: Windows variant - ( + pytest.param( [ "/dir/c:", "/dir/c:/windows/system32", @@ -153,9 +162,10 @@ def error(*args, **kwargs) -> None: "/dir", "[DirLoader('/dir')]", 0, + id="windows-variant", ), # Scenario 5: Hypothetical Dirloader with selection - ( + pytest.param( [ "/dir/select.txt", # selects 1 and 3 "/dir/raw1.img", @@ -165,6 +175,7 @@ def error(*args, **kwargs) -> None: "/dir", "[SelectLdr('/dir/raw1.img'), SelectLdr('/dir/raw3.img')]", 0, + id="dirloader-selection-variant", ), ], ) diff --git a/tests/test_volume.py b/tests/test_volume.py index 8f9c98bb3d..7bcce0f285 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -8,7 +8,7 @@ from dissect.target.volumes import disk -def test_reset_file_position() -> None: +def test_volume_reset_file_position() -> None: fh = BytesIO(b"\x00" * 8192) fh.seek(512) diff --git a/tests/tools/test_qfind.py b/tests/tools/test_qfind.py index adb40d9294..edd1478f4a 100644 --- a/tests/tools/test_qfind.py +++ b/tests/tools/test_qfind.py @@ -131,7 +131,7 @@ ), ], ) -def test_qfind( +def test_qfind_tool( target_bare: Target, buf: bytes, argv: list[str], diff --git a/tests/tools/test_reg.py b/tests/tools/test_reg.py index 9341802c48..6ff4b060c9 100644 --- a/tests/tools/test_reg.py +++ b/tests/tools/test_reg.py @@ -28,42 +28,62 @@ def target_win_reg(target_win: Target, fs_win: VirtualFilesystem) -> Target: ("provided_target", "provided_key", "arg_depth", "arg_length", "expected_output", "expected_log"), [ # test invalid target - ("target_default", "FOOBAR", 1, 100, "", "has no Windows Registry"), + pytest.param( + "target_default", + "FOOBAR", + 1, + 100, + "", + "has no Windows Registry", + id="invalid-target", + ), # test invalid key feedback - ("target_win_reg", "FOOBAR", 1, 100, "", "Key 'FOOBAR' does not exist"), - ( + pytest.param( + "target_win_reg", + "FOOBAR", + 1, + 100, + "", + "Key 'FOOBAR' does not exist", + id="invalid-key-1", + ), + pytest.param( "target_win_reg", "HKEY_LOCAL_MACHINE\\FOOBAR", 1, 100, "", "Key 'HKEY_LOCAL_MACHINE\\\\FOOBAR' does not exist", + id="invalid-key-2", ), # test key value abbrevation - ( + pytest.param( "target_win_reg", "HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\ComputerName", 1, 100, "- 'ComputerName' 'DESKTOP-M3OSHQU'", "", + id="key-abbr-1", ), - ( + pytest.param( "target_win_reg", "HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\ComputerName", 1, 10, "- 'ComputerName' 'DESKTOP-M...", "", + id="key-abbr-2", ), # test class name printing - ( + pytest.param( "target_win_reg", "HKLM\\SYSTEM\\ControlSet001\\Control\\Lsa\\Data", 1, 100, "+ 'Data' (2022-06-23 01:25:23.729778+00:00) (a282942c)", "", + id="class-name-printing", ), ], ) diff --git a/tests/tools/test_shell.py b/tests/tools/test_shell.py index b096603731..f662ef6a43 100644 --- a/tests/tools/test_shell.py +++ b/tests/tools/test_shell.py @@ -384,11 +384,12 @@ def test_redirect_syntax_error(target_win: Target, capsys: pytest.CaptureFixture ("/a/b/c|/d", "/a/1.txt|/b/2.txt|/d/3.txt", "/b", "b|b/2.txt"), ("/p/q/n", "/p/q/n/1.txt", "/p/q/n/1.txt", "1.txt"), ("/p/q/n", "/p/q/n/1.txt|2.txt", "/p/q/n/1.txt", "1.txt"), - ( + pytest.param( "/save_test/bin|save_test/data", "/save_test/data/hello|/save_test/bin/world", "/save_test", "save_test|save_test/bin|save_test/bin/world|save_test/data|save_test/data/hello", + id="extended", ), ], ) From dbcf64b4b7e28ce1648d6693b06602e27fdb1c76 Mon Sep 17 00:00:00 2001 From: Computer Network Investigation <121175071+JSCU-CNI@users.noreply.github.com> Date: Wed, 29 Apr 2026 10:28:24 +0200 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com> --- tests/conftest.py | 4 ++-- tests/loaders/test_kape.py | 2 +- tests/loaders/test_uac.py | 2 +- tests/loaders/test_vmsupport.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index eacaa53b62..452a16c634 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -81,13 +81,13 @@ def pytest_sessionstart(session: pytest.Session) -> None: ) break -function_names = {} +_function_names = {} @pytest.hookimpl(tryfirst=True) def pytest_pycollect_makemodule(module_path: str, parent: str) -> None: if duplicates := find_duplicate_functions(module_path): - pytest.exit(f"duplicate functions found in module: {module_path}: {duplicates}") + pytest.exit(f"duplicate test function names found in module: {module_path}: {duplicates}") def find_duplicate_functions(source_path: str) -> set[str]: diff --git a/tests/loaders/test_kape.py b/tests/loaders/test_kape.py index 40dcca25fa..ebf7b34277 100644 --- a/tests/loaders/test_kape.py +++ b/tests/loaders/test_kape.py @@ -51,7 +51,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_kape_dir: Path @patch("dissect.target.filesystems.dir.DirectoryFilesystem.ntfs", None, create=True) -def test_dir_kape(mock_kape_dir: Path) -> None: +def test_kape_dir(mock_kape_dir: Path) -> None: """Test the ``KapeLoader`` with a directory.""" loader = loader_open(mock_kape_dir) assert isinstance(loader, KapeLoader) diff --git a/tests/loaders/test_uac.py b/tests/loaders/test_uac.py index 8f36e854a0..66c400f913 100644 --- a/tests/loaders/test_uac.py +++ b/tests/loaders/test_uac.py @@ -109,7 +109,7 @@ def test_compressed_zip() -> None: assert test_file.open().readline() == b"root:x:0:0:root:/root:/bin/bash\n" -def test_dir_uac(mock_uac_dir: Path) -> None: +def test_uac_dir(mock_uac_dir: Path) -> None: """Test if we map an extracted UAC directory correctly.""" loader = loader_open(mock_uac_dir) assert isinstance(loader, UacLoader) diff --git a/tests/loaders/test_vmsupport.py b/tests/loaders/test_vmsupport.py index cf7e4b24ec..61d2de6034 100644 --- a/tests/loaders/test_vmsupport.py +++ b/tests/loaders/test_vmsupport.py @@ -88,7 +88,7 @@ def test_vmsupport_compressed_tar(data_path: str) -> None: assert b"/resourceGroups/version" in test_file.open().read() -def test_dir_vmsupport(mock_vmsupport_dir: Path) -> None: +def test_vmsupport_dir(mock_vmsupport_dir: Path) -> None: """Test if we map an extracted vm support directory correctly.""" loader = loader_open(mock_vmsupport_dir) assert isinstance(loader, VmSupportLoader) From 3079542638a7d25cfbd2f4a59d4a52f92a1a3115 Mon Sep 17 00:00:00 2001 From: JSCU-CNI <121175071+JSCU-CNI@users.noreply.github.com> Date: Wed, 29 Apr 2026 11:18:08 +0200 Subject: [PATCH 3/3] implement review feedback --- tests/conftest.py | 7 +- tests/helpers/test_magic.py | 296 +++++++++++++++------------ tests/loaders/test_ab.py | 4 +- tests/loaders/test_acquire.py | 2 +- tests/loaders/test_ad1.py | 2 +- tests/loaders/test_asdf.py | 2 +- tests/loaders/test_cb.py | 4 +- tests/loaders/test_cellebrite.py | 4 +- tests/loaders/test_containerimage.py | 2 +- tests/loaders/test_cyber.py | 4 +- tests/loaders/test_dir.py | 2 +- tests/loaders/test_hyperv.py | 4 +- tests/loaders/test_kape.py | 2 +- tests/loaders/test_libvirt.py | 4 +- tests/loaders/test_local.py | 2 +- tests/loaders/test_multiraw.py | 2 +- tests/loaders/test_nscollector.py | 2 +- tests/loaders/test_ova.py | 4 +- tests/loaders/test_overlay.py | 2 +- tests/loaders/test_overlay2.py | 2 +- tests/loaders/test_ovf.py | 4 +- tests/loaders/test_pvm.py | 4 +- tests/loaders/test_pvs.py | 4 +- tests/loaders/test_remote.py | 4 +- tests/loaders/test_smb.py | 4 +- tests/loaders/test_tanium.py | 4 +- tests/loaders/test_tar.py | 2 +- tests/loaders/test_uac.py | 2 +- tests/loaders/test_utm.py | 4 +- tests/loaders/test_vbk.py | 4 +- tests/loaders/test_vbox.py | 4 +- tests/loaders/test_velociraptor.py | 2 +- tests/loaders/test_vma.py | 4 +- tests/loaders/test_vmsupport.py | 2 +- tests/loaders/test_vmwarevm.py | 4 +- tests/loaders/test_vmx.py | 4 +- 36 files changed, 219 insertions(+), 190 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 452a16c634..8356ac54d9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -81,6 +81,7 @@ def pytest_sessionstart(session: pytest.Session) -> None: ) break + _function_names = {} @@ -94,14 +95,14 @@ def find_duplicate_functions(source_path: str) -> set[str]: source_code = pathlib.Path(source_path).read_text() tree = ast.parse(source_code, source_path) duplicates = set() - allowlist = ("test_other", "test_all", "test_target_open", "test_loader") + allowlist = ("test_other", "test_all",) # ast will find some example Plugin functions from test_plugin.py for node in ast.walk(tree): if isinstance(node, ast.FunctionDef) and node.name.startswith("test_") and node.name not in allowlist: - if node.name in function_names: + if node.name in _function_names: duplicates.add(node.name) else: - function_names[node.name] = node + _function_names[node.name] = node return duplicates diff --git a/tests/helpers/test_magic.py b/tests/helpers/test_magic.py index 9d68cbca4e..46b6e2bb1e 100755 --- a/tests/helpers/test_magic.py +++ b/tests/helpers/test_magic.py @@ -24,91 +24,101 @@ ("func", "input", "mime_out", "expected_output"), [ # Archives - ("from_buffer", bytes.fromhex("1f9d"), True, "application/x-compress"), - ("from_buffer", bytes.fromhex("1fa0"), True, "application/x-compress"), - ("from_buffer", bytes.fromhex("00002D6C68302D"), True, "application/x-lha"), - ("from_buffer", bytes.fromhex("00002D6C68352D"), True, "application/x-lha"), - ("from_buffer", bytes.fromhex("edabeedb"), True, "application/x-rpm"), - ("from_buffer", b"BZh", True, "application/x-bzip2"), - ("from_buffer", b"LZIP", True, "application/x-lzip"), - ("from_buffer", b"070701", True, "application/x-cpio"), - ("from_buffer", b"070702", True, "application/x-cpio"), - ("from_buffer", b"070707", True, "application/x-cpio"), - ("from_buffer", bytes.fromhex("504b0304"), True, "application/zip"), - ("from_buffer", bytes.fromhex("504b0506"), True, "application/zip"), - ("from_buffer", bytes.fromhex("504b0708"), True, "application/zip"), - ("from_buffer", bytes.fromhex("526172211a07"), True, "application/vnd.rar"), - ("from_buffer", bytes.fromhex("526172211a070100"), True, "application/vnd.rar"), - ("from_buffer", bytes.fromhex("0E031301"), True, "application/x-hdf"), - ("from_buffer", bytes.fromhex("894844460D0A1A0A"), True, "application/x-hdf"), - pytest.param("from_buffer", (b"\x00" * 0x8001) + b"CD001", True, "application/vnd.efi.iso", id="iso"), - ("from_buffer", b"xar!", True, "application/x-xar"), - pytest.param("from_buffer", (b"\x00" * 257) + b"ustar\x00\x30\x30", False, "Tar archive", id="tar1"), - pytest.param("from_buffer", (b"\x00" * 257) + b"ustar\x20\x20\x00", False, "Tar archive", id="tar2"), - ("from_buffer", b"\x37\x7a\xbc\xaf\x27\x1c", True, "application/x-7z-compressed"), - ("from_buffer", b"\x1f\x8b", True, "application/gzip"), - ("from_buffer", b"\xfd\x37\x7a\x58\x5a\x00", True, "application/x-xz"), - ("from_buffer", b"\x04\x22\x4d\x18", True, "application/x-lz4"), - ("from_buffer", b"MSCF\x00\x00\x00\x00", True, "application/vnd.ms-cab-compressed"), - ("from_buffer", b"\x78\x01", True, "application/zlib"), - ("from_buffer", b"\x78\x5e", True, "application/zlib"), - ("from_buffer", b"\x78\x9c", True, "application/zlib"), - ("from_buffer", b"\x78\xda", True, "application/zlib"), - ("from_buffer", b"\x78\x20", True, "application/zlib"), - ("from_buffer", b"\x78\x7d", True, "application/zlib"), - ("from_buffer", b"\x78\xbb", True, "application/zlib"), - ("from_buffer", b"\x78\xf9", True, "application/zlib"), - ("from_buffer", bytes.fromhex("4f626a01"), True, "application/avro"), - ("from_buffer", bytes.fromhex("28B52FFD"), True, "application/zstd"), - ("from_buffer", b"IsZ!", True, "application/vnd.efi.iso+compressed"), - ("from_buffer", b"TAPE", True, "application/vnd.ms-tape"), + pytest.param("from_buffer", bytes.fromhex("1f9d"), True, "application/x-compress", id="x-compress-1"), + pytest.param("from_buffer", bytes.fromhex("1fa0"), True, "application/x-compress", id="x-compress-2"), + pytest.param("from_buffer", bytes.fromhex("00002D6C68302D"), True, "application/x-lha", id="x-lha-1"), + pytest.param("from_buffer", bytes.fromhex("00002D6C68352D"), True, "application/x-lha", id="x-lha-2"), + pytest.param("from_buffer", bytes.fromhex("edabeedb"), True, "application/x-rpm", id="rpm"), + pytest.param("from_buffer", b"BZh", True, "application/x-bzip2", id="bzip2"), + pytest.param("from_buffer", b"LZIP", True, "application/x-lzip", id="lzip"), + pytest.param("from_buffer", b"070701", True, "application/x-cpio", id="cpio-1"), + pytest.param("from_buffer", b"070702", True, "application/x-cpio", id="cpio-2"), + pytest.param("from_buffer", b"070707", True, "application/x-cpio", id="cpio-3"), + pytest.param("from_buffer", bytes.fromhex("504b0304"), True, "application/zip", id="zip-1"), + pytest.param("from_buffer", bytes.fromhex("504b0506"), True, "application/zip", id="zip-2"), + pytest.param("from_buffer", bytes.fromhex("504b0708"), True, "application/zip", id="zip-3"), + pytest.param("from_buffer", bytes.fromhex("526172211a07"), True, "application/vnd.rar", id="rar-1"), + pytest.param("from_buffer", bytes.fromhex("526172211a070100"), True, "application/vnd.rar", id="rar-2"), + pytest.param("from_buffer", bytes.fromhex("0E031301"), True, "application/x-hdf", id="x-hdf-1"), + pytest.param("from_buffer", bytes.fromhex("894844460D0A1A0A"), True, "application/x-hdf", id="x-hdf-2"), + pytest.param("from_buffer", (b"\x00" * 0x8001) + b"CD001", True, "application/vnd.efi.iso", id="iso-1"), + pytest.param("from_buffer", b"xar!", True, "application/x-xar", id="x-xar"), + pytest.param("from_buffer", (b"\x00" * 257) + b"ustar\x00\x30\x30", False, "Tar archive", id="tar-1"), + pytest.param("from_buffer", (b"\x00" * 257) + b"ustar\x20\x20\x00", False, "Tar archive", id="tar-2"), + pytest.param("from_buffer", b"\x37\x7a\xbc\xaf\x27\x1c", True, "application/x-7z-compressed", id="7z"), + pytest.param("from_buffer", b"\x1f\x8b", True, "application/gzip", id="gzip"), + pytest.param("from_buffer", b"\xfd\x37\x7a\x58\x5a\x00", True, "application/x-xz", id="xz"), + pytest.param("from_buffer", b"\x04\x22\x4d\x18", True, "application/x-lz4", id="lz4"), + pytest.param("from_buffer", b"MSCF\x00\x00\x00\x00", True, "application/vnd.ms-cab-compressed", id="cab"), + pytest.param("from_buffer", b"\x78\x01", True, "application/zlib", id="zlib-1"), + pytest.param("from_buffer", b"\x78\x5e", True, "application/zlib", id="zlib-2"), + pytest.param("from_buffer", b"\x78\x9c", True, "application/zlib", id="zlib-3"), + pytest.param("from_buffer", b"\x78\xda", True, "application/zlib", id="zlib-4"), + pytest.param("from_buffer", b"\x78\x20", True, "application/zlib", id="zlib-5"), + pytest.param("from_buffer", b"\x78\x7d", True, "application/zlib", id="zlib-6"), + pytest.param("from_buffer", b"\x78\xbb", True, "application/zlib", id="zlib-7"), + pytest.param("from_buffer", b"\x78\xf9", True, "application/zlib", id="zlib-8"), + pytest.param("from_buffer", bytes.fromhex("4f626a01"), True, "application/avro", id="avro"), + pytest.param("from_buffer", bytes.fromhex("28B52FFD"), True, "application/zstd", id="zstd"), + pytest.param("from_buffer", b"IsZ!", True, "application/vnd.efi.iso+compressed", id="iso-2"), + pytest.param("from_buffer", b"TAPE", True, "application/vnd.ms-tape", id="tape"), # Database formats - ("from_buffer", b"SQLite format 3\x00FILE DATA\x4d\x3c\xb2\xa1", True, "application/vnd.sqlite3"), - ("from_buffer", b"SQLite format 3\x00FILE DATA\x4d\x3c\xb2\xa1", None, "SQLite3 database"), - ("from_buffer", b"DUCK", True, "application/x-duckdb"), + pytest.param( + "from_buffer", + b"SQLite format 3\x00FILE DATA\x4d\x3c\xb2\xa1", + True, + "application/vnd.sqlite3", + id="sqlite-1", + ), + pytest.param( + "from_buffer", b"SQLite format 3\x00FILE DATA\x4d\x3c\xb2\xa1", None, "SQLite3 database", id="sqlite-2" + ), + pytest.param("from_buffer", b"DUCK", True, "application/x-duckdb", id="duckdb"), # Images - ("from_buffer", b"\x00\x00\x01\x00", True, "image/vnd.microsoft.icon"), - ("from_buffer", b"icns", True, "image/x-icns"), - ("from_buffer", (b"\x00" * 4) + b"ftypheic", True, "image/heif"), - ("from_buffer", b"GIF87a", True, "image/gif"), - ("from_buffer", b"GIF89a", True, "image/gif"), - ("from_buffer", bytes.fromhex("49492a00"), True, "image/tiff"), - ("from_buffer", bytes.fromhex("4d4d002a"), True, "image/tiff"), - ("from_buffer", bytes.fromhex("49492B00"), True, "image/bigtiff"), - ("from_buffer", bytes.fromhex("4D4D002B"), True, "image/bigtiff"), - ("from_buffer", bytes.fromhex("49492A00100000004352"), True, "image/tiff"), - ("from_buffer", bytes.fromhex("425047FB"), True, "image/bpg"), - ("from_buffer", bytes.fromhex("ffd8ffdb010203"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("ffd8ffdb010203"), False, "JPEG image"), - ("from_buffer", bytes.fromhex("FFD8FFE000104A4649460001"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("FFD8FFEE"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("FFD8FFE1"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("FFD8FFE0"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("ffd8ffdb"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("ffd8ffe0"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("ffd8ffe1"), True, "image/jpeg"), - ("from_buffer", bytes.fromhex("0000000C6A5020200D0A870A"), True, "image/jp2"), - ("from_buffer", bytes.fromhex("FF4FFF51"), True, "image/x-jp2-codestream"), - ("from_buffer", bytes.fromhex("89504e470d0a1a0a"), True, "image/png"), - ("from_buffer", b"8BPS \x00\x00\x00\x00", True, "image/vnd.adobe.photoshop"), + pytest.param("from_buffer", b"\x00\x00\x01\x00", True, "image/vnd.microsoft.icon", id="msicon"), + pytest.param("from_buffer", b"icns", True, "image/x-icns", id="x-icns"), + pytest.param("from_buffer", (b"\x00" * 4) + b"ftypheic", True, "image/heif", id="heif"), + pytest.param("from_buffer", b"GIF87a", True, "image/gif", id="gif-1"), + pytest.param("from_buffer", b"GIF89a", True, "image/gif", id="gif-2"), + pytest.param("from_buffer", bytes.fromhex("49492a00"), True, "image/tiff", id="tiff-1"), + pytest.param("from_buffer", bytes.fromhex("4d4d002a"), True, "image/tiff", id="tiff-2"), + pytest.param("from_buffer", bytes.fromhex("49492B00"), True, "image/bigtiff", id="bigtiff-1"), + pytest.param("from_buffer", bytes.fromhex("4D4D002B"), True, "image/bigtiff", id="bigtiff-2"), + pytest.param("from_buffer", bytes.fromhex("49492A00100000004352"), True, "image/tiff", id="tiff-3"), + pytest.param("from_buffer", bytes.fromhex("425047FB"), True, "image/bpg", id="bpg"), + pytest.param("from_buffer", bytes.fromhex("ffd8ffdb010203"), True, "image/jpeg", id="jpeg-1"), + pytest.param("from_buffer", bytes.fromhex("ffd8ffdb010203"), False, "JPEG image", id="jpeg-2"), + pytest.param("from_buffer", bytes.fromhex("FFD8FFE000104A4649460001"), True, "image/jpeg", id="jpeg-3"), + pytest.param("from_buffer", bytes.fromhex("FFD8FFEE"), True, "image/jpeg", id="jpeg-4"), + pytest.param("from_buffer", bytes.fromhex("FFD8FFE1"), True, "image/jpeg", id="jpeg-5"), + pytest.param("from_buffer", bytes.fromhex("FFD8FFE0"), True, "image/jpeg", id="jpeg-6"), + pytest.param("from_buffer", bytes.fromhex("ffd8ffdb"), True, "image/jpeg", id="jpeg-7"), + pytest.param("from_buffer", bytes.fromhex("ffd8ffe0"), True, "image/jpeg", id="jpeg-8"), + pytest.param("from_buffer", bytes.fromhex("ffd8ffe1"), True, "image/jpeg", id="jpeg-9"), + pytest.param("from_buffer", bytes.fromhex("0000000C6A5020200D0A870A"), True, "image/jp2", id="jp2-1"), + pytest.param("from_buffer", bytes.fromhex("FF4FFF51"), True, "image/x-jp2-codestream", id="jp2-2"), + pytest.param("from_buffer", bytes.fromhex("89504e470d0a1a0a"), True, "image/png", id="png-1"), + pytest.param("from_buffer", b"8BPS \x00\x00\x00\x00", True, "image/vnd.adobe.photoshop", id="psd"), # Audio and video - ("from_buffer", b"OggS", True, "application/ogg"), - ("from_buffer", bytes.fromhex("52494646"), True, "application/x-riff"), - ("from_buffer", bytes.fromhex("fffb"), True, "audio/mpeg"), - ("from_buffer", bytes.fromhex("fff3"), True, "audio/mpeg"), - ("from_buffer", bytes.fromhex("fff2"), True, "audio/mpeg"), - ("from_buffer", b"ID3", True, "audio/mpeg"), - ("from_buffer", b"fLaC", True, "audio/flac"), - ("from_buffer", b"MThd", True, "audio/midi"), - ("from_buffer", bytes.fromhex("1A45DFA3"), True, "application/x-matroska"), - ("from_buffer", b"\x00\x00\x00\x00ftypisom", True, "video/mp4"), - ("from_buffer", b"\x00\x00\x00\x00ftypMSNV", True, "video/mp4"), - ("from_buffer", b"#EXTM3U", True, "audio/x-mpegurl"), + pytest.param("from_buffer", b"OggS", True, "application/ogg", id="ogg"), + pytest.param("from_buffer", bytes.fromhex("52494646"), True, "application/x-riff", id="riff"), + pytest.param("from_buffer", bytes.fromhex("fffb"), True, "audio/mpeg", id="mpeg-1"), + pytest.param("from_buffer", bytes.fromhex("fff3"), True, "audio/mpeg", id="mpeg-2"), + pytest.param("from_buffer", bytes.fromhex("fff2"), True, "audio/mpeg", id="mpeg-3"), + pytest.param("from_buffer", b"ID3", True, "audio/mpeg", id="mpeg-4"), + pytest.param("from_buffer", b"fLaC", True, "audio/flac", id="flac"), + pytest.param("from_buffer", b"MThd", True, "audio/midi", id="midi"), + pytest.param("from_buffer", bytes.fromhex("1A45DFA3"), True, "application/x-matroska", id="mkv"), + pytest.param("from_buffer", b"\x00\x00\x00\x00ftypisom", True, "video/mp4", id="mp4-1"), + pytest.param("from_buffer", b"\x00\x00\x00\x00ftypMSNV", True, "video/mp4", id="mp4-2"), + pytest.param("from_buffer", b"#EXTM3U", True, "audio/x-mpegurl", id="mpeg-5"), # Productivity - ("from_buffer", b"\x25\x50\x44\x46-", True, "application/pdf"), - ("from_buffer", b"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1", True, "application/vnd.ms-excel"), - ("from_buffer", b"Received:", True, "message/rfc822"), - ("from_buffer", b"!BDN", True, "application/vnd.ms-outlook-pst"), + pytest.param("from_buffer", b"\x25\x50\x44\x46-", True, "application/pdf", id="pdf"), + pytest.param( + "from_buffer", b"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1", True, "application/vnd.ms-excel", id="msexcel" + ), + pytest.param("from_buffer", b"Received:", True, "message/rfc822", id="email"), + pytest.param("from_buffer", b"!BDN", True, "application/vnd.ms-outlook-pst", id="pst"), pytest.param( "from_buffer", (b"\x00" * 2112) + b"Microsoft Word document data", @@ -124,67 +134,85 @@ id="mspowerpoint", ), # Executables - ("from_buffer", b"MZ", True, "application/x-ms-dos-executable"), - ("from_buffer", bytes.fromhex("7F454C46"), True, "application/x-executable"), - ("from_buffer", bytes.fromhex("cafebabe"), True, "application/x-java"), - ("from_buffer", bytes.fromhex("feedface"), True, "application/x-mach-o"), - ("from_buffer", bytes.fromhex("feedfacf"), True, "application/x-mach-o"), - ("from_buffer", bytes.fromhex("feedfeed"), True, "application/x-java-keystore"), - ("from_buffer", bytes.fromhex("cefaedfe"), True, "application/x-mach-o"), - ("from_buffer", bytes.fromhex("cffaedfe"), True, "application/x-mach-o"), - ("from_buffer", b"%!PS", True, "application/postscript"), - ("from_buffer", b"\x00asm", True, "application/wasm"), - ("from_buffer", b"!\x0a", True, "application/vnd.debian.binary-package"), - ("from_buffer", bytes.fromhex("1B4C7561"), True, "application/x-lua"), + pytest.param("from_buffer", b"MZ", True, "application/x-ms-dos-executable", id="mz"), + pytest.param("from_buffer", bytes.fromhex("7F454C46"), True, "application/x-executable", id="elf"), + pytest.param("from_buffer", bytes.fromhex("cafebabe"), True, "application/x-java", id="java"), + pytest.param("from_buffer", bytes.fromhex("feedface"), True, "application/x-mach-o", id="macho-1"), + pytest.param("from_buffer", bytes.fromhex("feedfacf"), True, "application/x-mach-o", id="macho-2"), + pytest.param("from_buffer", bytes.fromhex("feedfeed"), True, "application/x-java-keystore", id="jks"), + pytest.param("from_buffer", bytes.fromhex("cefaedfe"), True, "application/x-mach-o", id="macho-3"), + pytest.param("from_buffer", bytes.fromhex("cffaedfe"), True, "application/x-mach-o", id="macho-4"), + pytest.param("from_buffer", b"%!PS", True, "application/postscript", id="ps"), + pytest.param("from_buffer", b"\x00asm", True, "application/wasm", id="wasm"), + pytest.param("from_buffer", b"!\x0a", True, "application/vnd.debian.binary-package", id="deb"), + pytest.param("from_buffer", bytes.fromhex("1B4C7561"), True, "application/x-lua", id="lua"), # Network - ("from_buffer", bytes.fromhex("d4c3b2a1"), True, "application/vnd.tcpdump.pcap"), - ("from_buffer", bytes.fromhex("a1b2c3d4"), True, "application/vnd.tcpdump.pcap"), - ("from_buffer", bytes.fromhex("4d3cb2a1"), True, "application/vnd.tcpdump.pcap"), - ("from_buffer", bytes.fromhex("a1b23c4d"), True, "application/vnd.tcpdump.pcap"), - ("from_buffer", bytes.fromhex("0a0d0d0a"), True, "application/x-pcapng"), + pytest.param("from_buffer", bytes.fromhex("d4c3b2a1"), True, "application/vnd.tcpdump.pcap", id="pcap-1"), + pytest.param("from_buffer", bytes.fromhex("a1b2c3d4"), True, "application/vnd.tcpdump.pcap", id="pcap-2"), + pytest.param("from_buffer", bytes.fromhex("4d3cb2a1"), True, "application/vnd.tcpdump.pcap", id="pcap-3"), + pytest.param("from_buffer", bytes.fromhex("a1b23c4d"), True, "application/vnd.tcpdump.pcap", id="pcap-4"), + pytest.param("from_buffer", bytes.fromhex("0a0d0d0a"), True, "application/x-pcapng", id="pcapng"), # Certificates - ("from_buffer", b"-----BEGIN CERTIFICATE-----", True, "application/pkix-cert"), - ("from_buffer", b"-----BEGIN CERTIFICATE REQUEST-----", True, "text/pkix-csr"), - ("from_buffer", b"-----BEGIN PRIVATE KEY-----", True, "text/x-ssh-private-key"), - ("from_buffer", b"-----BEGIN DSA PRIVATE KEY-----", True, "text/x-ssh-private-key"), - ("from_buffer", b"-----BEGIN RSA PRIVATE KEY-----", True, "text/x-ssh-private-key"), - ("from_buffer", b"PuTTY-User-Key-File-2:", True, "text/x-putty-private-key"), - ("from_buffer", b"PuTTY-User-Key-File-3:", True, "text/x-putty-private-key"), - ("from_buffer", b"-----BEGIN OPENSSH PRIVATE KEY-----", True, "text/x-ssh-private-key"), - ("from_buffer", b"-----BEGIN SSH2 PUBLIC KEY-----", True, "text/x-ssh-public-key"), - ("from_buffer", b"-----BEGIN PGP PUBLIC KEY BLOCK-----", True, "application/pgp-keys"), + pytest.param("from_buffer", b"-----BEGIN CERTIFICATE-----", True, "application/pkix-cert", id="crt"), + pytest.param("from_buffer", b"-----BEGIN CERTIFICATE REQUEST-----", True, "text/pkix-csr", id="csr"), + pytest.param("from_buffer", b"-----BEGIN PRIVATE KEY-----", True, "text/x-ssh-private-key", id="privkey-1"), + pytest.param("from_buffer", b"-----BEGIN DSA PRIVATE KEY-----", True, "text/x-ssh-private-key", id="privkey-2"), + pytest.param("from_buffer", b"-----BEGIN RSA PRIVATE KEY-----", True, "text/x-ssh-private-key", id="privkey-3"), + pytest.param("from_buffer", b"PuTTY-User-Key-File-2:", True, "text/x-putty-private-key", id="puttykey-1"), + pytest.param("from_buffer", b"PuTTY-User-Key-File-3:", True, "text/x-putty-private-key", id="puttykey-2"), + pytest.param( + "from_buffer", b"-----BEGIN OPENSSH PRIVATE KEY-----", True, "text/x-ssh-private-key", id="privkey-4" + ), + pytest.param("from_buffer", b"-----BEGIN SSH2 PUBLIC KEY-----", True, "text/x-ssh-public-key", id="pubkey-1"), + pytest.param( + "from_buffer", b"-----BEGIN PGP PUBLIC KEY BLOCK-----", True, "application/pgp-keys", id="pubkey-2" + ), # Web - ("from_buffer", b"wOFF", True, "font/woff"), - ("from_buffer", b"wOF2", True, "font/woff2"), - ("from_buffer", b"ITSF\x03\x00\x00\x00\x60\x00\x00\x00", True, "application/vnd.ms-htmlhelp"), + pytest.param("from_buffer", b"wOFF", True, "font/woff", id="woff"), + pytest.param("from_buffer", b"wOF2", True, "font/woff2", id="woff2"), + pytest.param( + "from_buffer", b"ITSF\x03\x00\x00\x00\x60\x00\x00\x00", True, "application/vnd.ms-htmlhelp", id="mshelp" + ), # Containers and disks - ("from_buffer", b"KDMV\x01\x00\x00\x00", True, "application/x-vmdk-disk"), - ("from_buffer", b"AFF", True, "application/x-aff"), - ("from_buffer", b"EVF2", True, "application/x-encase"), - ("from_buffer", b"EVF", True, "application/x-encase"), - ("from_buffer", b"QFI\xfb", True, "application/x-qemu-disk"), - ("from_buffer", b"<<< Oracle VM VirtualBox Disk Image >>>", True, "application/x-oracle-virtualbox-vdi"), - ("from_buffer", b"conectix", True, "application/x-vhd-disk"), - ("from_buffer", b"vhdxfile", True, "application/x-vhdx-disk"), - ("from_buffer", b"MSWIM\x00\x00\x00\xd0\x00\x00\x00\x00", True, "application/x-ms-wim"), + pytest.param("from_buffer", b"KDMV\x01\x00\x00\x00", True, "application/x-vmdk-disk", id="vmdk"), + pytest.param("from_buffer", b"AFF", True, "application/x-aff", id="x-aff"), + pytest.param("from_buffer", b"EVF2", True, "application/x-encase", id="evf2"), + pytest.param("from_buffer", b"EVF", True, "application/x-encase", id="evf"), + pytest.param("from_buffer", b"QFI\xfb", True, "application/x-qemu-disk", id="qfi"), + pytest.param( + "from_buffer", + b"<<< Oracle VM VirtualBox Disk Image >>>", + True, + "application/x-oracle-virtualbox-vdi", + id="vdi", + ), + pytest.param("from_buffer", b"conectix", True, "application/x-vhd-disk", id="vhd"), + pytest.param("from_buffer", b"vhdxfile", True, "application/x-vhdx-disk", id="vhdx"), + pytest.param("from_buffer", b"MSWIM\x00\x00\x00\xd0\x00\x00\x00\x00", True, "application/x-ms-wim", id="mswim"), # Log files - ("from_buffer", b"LfLe", True, "application/x-win-evt"), - ("from_buffer", b"ElfFile", True, "application/x-win-evtx"), - ("from_buffer", b"regf", True, "application/x-win-regf"), - ("from_buffer", b"[ZoneTransfer]", True, "application/x-win-zonetransfer"), - ("from_buffer", b"LPKSHHRH", True, "application/x-systemd-journald-log"), - ("from_buffer", b"\xc0\x3b\x39\x98", True, "application/x-ext-jbd-fs-journal"), + pytest.param("from_buffer", b"LfLe", True, "application/x-win-evt", id="evt"), + pytest.param("from_buffer", b"ElfFile", True, "application/x-win-evtx", id="evtx"), + pytest.param("from_buffer", b"regf", True, "application/x-win-regf", id="regf"), + pytest.param("from_buffer", b"[ZoneTransfer]", True, "application/x-win-zonetransfer", id="zonetransfer"), + pytest.param("from_buffer", b"LPKSHHRH", True, "application/x-systemd-journald-log", id="journal-1"), + pytest.param("from_buffer", b"\xc0\x3b\x39\x98", True, "application/x-ext-jbd-fs-journal", id="journal-2"), # Other data formats - ("from_buffer", b"bplist", True, "application/x-plist"), - ("from_buffer", b" None: +def test_target_open_ab(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``AndroidBackupLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/ab/test.ab") keychain.register_wildcard_value("password") @@ -34,7 +34,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == path -def test_loader() -> None: +def test_ab_loader() -> None: """Test the Android Backup loader.""" path = absolute_path("_data/loaders/ab/test.ab") keychain.register_wildcard_value("password") diff --git a/tests/loaders/test_acquire.py b/tests/loaders/test_acquire.py index b0cfd1f14d..13964a889a 100644 --- a/tests/loaders/test_acquire.py +++ b/tests/loaders/test_acquire.py @@ -28,7 +28,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_acquire(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``AcquireTarSubLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/acquire/test-windows-sysvol-absolute.tar") diff --git a/tests/loaders/test_ad1.py b/tests/loaders/test_ad1.py index 78370f4b88..882e51f693 100644 --- a/tests/loaders/test_ad1.py +++ b/tests/loaders/test_ad1.py @@ -22,7 +22,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_ad1(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``AD1Loader`` when opening a ``Target``.""" path = absolute_path("_data/filesystems/ad1/encrypted-small.ad1") diff --git a/tests/loaders/test_asdf.py b/tests/loaders/test_asdf.py index 62d31ed1b0..1441e2564c 100644 --- a/tests/loaders/test_asdf.py +++ b/tests/loaders/test_asdf.py @@ -22,7 +22,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_asdf(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``AsdfLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/asdf/metadata.asdf") diff --git a/tests/loaders/test_cb.py b/tests/loaders/test_cb.py index 98e952ada4..58b101148f 100644 --- a/tests/loaders/test_cb.py +++ b/tests/loaders/test_cb.py @@ -67,7 +67,7 @@ def mock_session(mock_device: MagicMock) -> MagicMock: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_session: MagicMock) -> None: +def test_target_open_cb(opener: Callable[[str | Path], Target], mock_session: MagicMock) -> None: """Test that we correctly use ``CbLoader`` when opening a ``Target``.""" from dissect.target.loaders.cb import CbLoader @@ -79,7 +79,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_session: Magic assert target.path == Path("instance/workstation") -def test_loader(mock_session: MagicMock, mock_cbc_sdk: MagicMock) -> None: +def test_cb_loader(mock_session: MagicMock, mock_cbc_sdk: MagicMock) -> None: """Test the CB loader.""" from dissect.target.filesystems.cb import CbFilesystem from dissect.target.loader import open as loader_open diff --git a/tests/loaders/test_cellebrite.py b/tests/loaders/test_cellebrite.py index 2e6640d682..24a12cd58e 100644 --- a/tests/loaders/test_cellebrite.py +++ b/tests/loaders/test_cellebrite.py @@ -21,7 +21,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_cellebrite(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``CellebriteLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/cellebrite/EvidenceCollection.ufdx") @@ -30,7 +30,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == path -def test_loader() -> None: +def test_cellebrite_loader() -> None: """Test if we correctly detect and load a Cellebrite UFDX FFS zip extraction from DigitalCorpora (``iOS_17``). The content of the ``EXTRACTION_FFS.zip`` file has been replaced with a minimal linux folder structure diff --git a/tests/loaders/test_containerimage.py b/tests/loaders/test_containerimage.py index 1f56668f87..344bbeb1a0 100644 --- a/tests/loaders/test_containerimage.py +++ b/tests/loaders/test_containerimage.py @@ -22,7 +22,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_containerimage(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``ContainerImageTarSubLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/containerimage/alpine-docker.tar") diff --git a/tests/loaders/test_cyber.py b/tests/loaders/test_cyber.py index c143991660..00a1577560 100644 --- a/tests/loaders/test_cyber.py +++ b/tests/loaders/test_cyber.py @@ -23,7 +23,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_cyber(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``CyberLoader`` when opening a ``Target``.""" file_path = absolute_path("_data/loaders/tar/test-archive.tar") path = f"cyber://{file_path}" @@ -35,7 +35,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == file_path -def test_loader() -> None: +def test_cyber_loader() -> None: """Test that ``CyberLoader`` correctly loads a Cyber file.""" path = f"cyber://{absolute_path('_data/loaders/tar/test-archive.tar')}" diff --git a/tests/loaders/test_dir.py b/tests/loaders/test_dir.py index cf9e8793f7..3f906a7bac 100644 --- a/tests/loaders/test_dir.py +++ b/tests/loaders/test_dir.py @@ -22,7 +22,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: +def test_target_open_dir(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: """Test that we correctly use ``DirLoader`` when opening a ``Target``.""" root = tmp_path mkdirs(root, ["windows/system32"]) diff --git a/tests/loaders/test_hyperv.py b/tests/loaders/test_hyperv.py index f6cf925a36..d43cad6dcb 100644 --- a/tests/loaders/test_hyperv.py +++ b/tests/loaders/test_hyperv.py @@ -24,7 +24,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_hyperv(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``HyperVLoader`` when opening a ``Target``.""" for path in [ absolute_path("_data/loaders/hyperv/B90AC31B-C6F8-479F-9B91-07B894A6A3F6.xml"), @@ -51,7 +51,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: ("c:\\Virtual Machines", "c:\\Disks"), ], ) -def test_loader(descriptor_dir: str, disk_dir: str, target_bare: Target) -> None: +def test_hyperv_loader(descriptor_dir: str, disk_dir: str, target_bare: Target) -> None: """Test the Hyper-V loader with XML and VMCX descriptor files.""" gen1_xml_filename = "B90AC31B-C6F8-479F-9B91-07B894A6A3F6.xml" gen2_xml_filename = "D351C151-DAC7-4042-B434-B72D522C1E4A.xml" diff --git a/tests/loaders/test_kape.py b/tests/loaders/test_kape.py index ebf7b34277..806bb540b7 100644 --- a/tests/loaders/test_kape.py +++ b/tests/loaders/test_kape.py @@ -42,7 +42,7 @@ def mock_kape_dir(tmp_path: Path) -> Path: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_kape_dir: Path) -> None: +def test_target_open_kape(opener: Callable[[str | Path], Target], mock_kape_dir: Path) -> None: """Test that we correctly use ``KapeLoader`` when opening a ``Target``.""" for path in [mock_kape_dir, absolute_path("_data/loaders/kape/test.vhdx")]: target = opener(path) diff --git a/tests/loaders/test_libvirt.py b/tests/loaders/test_libvirt.py index e98247b677..4d7bbcea37 100644 --- a/tests/loaders/test_libvirt.py +++ b/tests/loaders/test_libvirt.py @@ -23,7 +23,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_libvirt(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``LibvirtLoader`` when opening a ``Target``.""" vfs = VirtualFilesystem() vfs.map_file("/test.xml", absolute_path("_data/loaders/libvirt/qemu.xml")) @@ -37,7 +37,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == path -def test_loader(tmp_path: Path) -> None: +def test_libvirt_loader(tmp_path: Path) -> None: """Test that ``LibvirtLoader`` works with local files, absolute and relative.""" xml_file = tmp_path.joinpath("base") xml_file.write_text("not a libvirt file") diff --git a/tests/loaders/test_local.py b/tests/loaders/test_local.py index 4a30cc5257..a0295fa375 100644 --- a/tests/loaders/test_local.py +++ b/tests/loaders/test_local.py @@ -29,7 +29,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_local(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``LocalLoader`` when opening a ``Target``.""" for path in ["local", "local?some=query"]: with patch("dissect.target.target.Target.apply"): diff --git a/tests/loaders/test_multiraw.py b/tests/loaders/test_multiraw.py index c87eb8fb2b..3ab2c64f48 100644 --- a/tests/loaders/test_multiraw.py +++ b/tests/loaders/test_multiraw.py @@ -23,7 +23,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: +def test_target_open_multiraw(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: """Test that we correctly use ``MultiRawLoader`` when opening a ``Target``.""" file1 = tmp_path / "file1.bin" file2 = tmp_path / "file2.bin" diff --git a/tests/loaders/test_nscollector.py b/tests/loaders/test_nscollector.py index 84419322c3..95d0c1c4ec 100644 --- a/tests/loaders/test_nscollector.py +++ b/tests/loaders/test_nscollector.py @@ -23,7 +23,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_nscollector(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``NsCollectorTarSubLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/nscollector/collector_P_10.164.0.3_22Oct2025_11_31.tar.gz") diff --git a/tests/loaders/test_ova.py b/tests/loaders/test_ova.py index da00972a51..69c6a0c3fd 100644 --- a/tests/loaders/test_ova.py +++ b/tests/loaders/test_ova.py @@ -22,7 +22,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: +def test_target_open_ova(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: """Test that we correctly use ``OvaLoader`` when opening a ``Target``.""" path = tmp_path / "test.ova" @@ -43,7 +43,7 @@ def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> assert target.path == path -def test_loader(tmp_path: Path) -> None: +def test_ova_loader(tmp_path: Path) -> None: """Test that ``OvaLoader`` correctly loads an OVA file and its disks.""" path = tmp_path / "test.ova" diff --git a/tests/loaders/test_overlay.py b/tests/loaders/test_overlay.py index f3e0e5fed0..1678a1895b 100644 --- a/tests/loaders/test_overlay.py +++ b/tests/loaders/test_overlay.py @@ -39,7 +39,7 @@ def mock_oci_podman_fs() -> VirtualFilesystem: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_oci_podman_fs: VirtualFilesystem) -> None: +def test_target_open_overlay(opener: Callable[[str | Path], Target], mock_oci_podman_fs: VirtualFilesystem) -> None: """Test that we correctly use ``OverlayLoader`` when opening a ``Target``.""" path = mock_oci_podman_fs.path(BASE_PATH) target = opener(path) diff --git a/tests/loaders/test_overlay2.py b/tests/loaders/test_overlay2.py index edb179a766..72d7c1e0a1 100644 --- a/tests/loaders/test_overlay2.py +++ b/tests/loaders/test_overlay2.py @@ -20,7 +20,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], target_linux_docker: Target) -> None: +def test_target_open_overlay2(opener: Callable[[str | Path], Target], target_linux_docker: Target) -> None: """Test that we correctly use ``Overlay2Loader`` when opening a ``Target``.""" for container in [ "589135d12011921ac6ce69753569da5f206f4bc792a9133727ddae860997ee66", diff --git a/tests/loaders/test_ovf.py b/tests/loaders/test_ovf.py index e25ee05fd7..98da57c237 100644 --- a/tests/loaders/test_ovf.py +++ b/tests/loaders/test_ovf.py @@ -21,7 +21,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: +def test_target_open_ovf(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: """Test that we correctly use ``OvfLoader`` when opening a ``Target``.""" path = tmp_path / "test.ovf" path.touch() @@ -39,7 +39,7 @@ def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> assert target.path == path -def test_loader(tmp_path: Path) -> None: +def test_ovf_loader(tmp_path: Path) -> None: """Test that ``OvfLoader`` correctly loads an OVF file and its disks.""" path = tmp_path / "test.ovf" path.touch() diff --git a/tests/loaders/test_pvm.py b/tests/loaders/test_pvm.py index 9b33477334..ff7acb38f3 100644 --- a/tests/loaders/test_pvm.py +++ b/tests/loaders/test_pvm.py @@ -34,7 +34,7 @@ def mock_pvm_dir(tmp_path: Path) -> Iterator[Path]: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_pvm_dir: Path) -> None: +def test_target_open_pvm(opener: Callable[[str | Path], Target], mock_pvm_dir: Path) -> None: """Test that we correctly use ``PvmLoader`` when opening a ``Target``.""" with patch("dissect.target.container.open"), patch("dissect.target.target.Target.apply"): target = opener(mock_pvm_dir) @@ -42,7 +42,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_pvm_dir: Path) assert target.path == mock_pvm_dir -def test_loader(mock_pvm_dir: Path) -> None: +def test_pvm_loader(mock_pvm_dir: Path) -> None: """Test that ``PvmLoader`` correctly loads a PVM file and its disks.""" with patch("dissect.target.container.open") as mock_container_open: loader = loader_open(mock_pvm_dir) diff --git a/tests/loaders/test_pvs.py b/tests/loaders/test_pvs.py index f2aef338dd..ab137398ed 100644 --- a/tests/loaders/test_pvs.py +++ b/tests/loaders/test_pvs.py @@ -21,7 +21,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: +def test_target_open_pvs(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: """Test that we correctly use ``PvsLoader`` when opening a ``Target``.""" path = tmp_path / "config.pvs" path.touch() @@ -39,7 +39,7 @@ def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> assert target.path == path -def test_loader(tmp_path: Path) -> None: +def test_pvs_loader(tmp_path: Path) -> None: """Test that ``PvsLoader`` correctly loads a PVS file and its disks.""" path = tmp_path / "config.pvs" path.touch() diff --git a/tests/loaders/test_remote.py b/tests/loaders/test_remote.py index 0e8d7c7317..fd44a5ddf7 100644 --- a/tests/loaders/test_remote.py +++ b/tests/loaders/test_remote.py @@ -24,7 +24,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_remote(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``RemoteLoader`` when opening a ``Target``.""" path = "remote://127.0.0.1:1337" with ( @@ -37,7 +37,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == Path("127.0.0.1:1337") -def test_loader() -> None: +def test_remote_loader() -> None: """Test that ``RemoteLoader`` is correctly selected.""" with patch.object(ssl, "SSLContext", autospec=True): loader = loader_open("remote://127.0.0.1:1337") diff --git a/tests/loaders/test_smb.py b/tests/loaders/test_smb.py index 666a597d19..42133a9c26 100644 --- a/tests/loaders/test_smb.py +++ b/tests/loaders/test_smb.py @@ -54,7 +54,7 @@ def mock_connection(mock_impacket: MagicMock) -> MagicMock: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_connection: MagicMock) -> None: +def test_target_open_smb(opener: Callable[[str | Path], Target], mock_connection: MagicMock) -> None: """Test that we correctly use ``SmbLoader`` when opening a ``Target``.""" from dissect.target.loaders.smb import SmbLoader @@ -65,7 +65,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_connection: Ma assert target.path == Path("host") -def test_loader(mock_impacket: MagicMock, mock_connection: MagicMock) -> None: +def test_smb_loader(mock_impacket: MagicMock, mock_connection: MagicMock) -> None: from dissect.target.filesystems.smb import SmbFilesystem from dissect.target.loader import open as loader_open from dissect.target.loaders.smb import SmbLoader, SmbRegistry diff --git a/tests/loaders/test_tanium.py b/tests/loaders/test_tanium.py index 1d529d7684..48030552d9 100644 --- a/tests/loaders/test_tanium.py +++ b/tests/loaders/test_tanium.py @@ -40,7 +40,7 @@ def mock_tanium_dir(tmp_path: Path) -> Path: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_tanium_dir: Path) -> None: +def test_target_open_tanium(opener: Callable[[str | Path], Target], mock_tanium_dir: Path) -> None: """Test that we correctly use ``TaniumLoader`` when opening a ``Target``.""" path = mock_tanium_dir @@ -49,7 +49,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_tanium_dir: Pa assert target.path == path -def test_loader(mock_tanium_dir: Path) -> None: +def test_tanium_loader(mock_tanium_dir: Path) -> None: loader = loader_open(mock_tanium_dir) assert isinstance(loader, TaniumLoader) diff --git a/tests/loaders/test_tar.py b/tests/loaders/test_tar.py index d008d3c772..4534e708a0 100644 --- a/tests/loaders/test_tar.py +++ b/tests/loaders/test_tar.py @@ -26,7 +26,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_tar(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``TarLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/tar/test-archive.tar") diff --git a/tests/loaders/test_uac.py b/tests/loaders/test_uac.py index 66c400f913..618a4174d8 100644 --- a/tests/loaders/test_uac.py +++ b/tests/loaders/test_uac.py @@ -46,7 +46,7 @@ def mock_uac_dir(tmp_path: Path) -> Path: ("mock_uac_dir", UacLoader), ], ) -def test_target_open( +def test_target_open_uac( opener: Callable[[str | Path], Target], path: str, loader: type[Loader], mock_uac_dir: Path ) -> None: """Test that we correctly use the UAC loaders when opening a ``Target``.""" diff --git a/tests/loaders/test_utm.py b/tests/loaders/test_utm.py index 92d4bdc198..3bbea84e2d 100644 --- a/tests/loaders/test_utm.py +++ b/tests/loaders/test_utm.py @@ -57,7 +57,7 @@ def mock_utm_dir(tmp_path: Path) -> Path: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_utm_dir: Path) -> None: +def test_target_open_utm(opener: Callable[[str | Path], Target], mock_utm_dir: Path) -> None: """Test that we correctly use ``UtmLoader`` when opening a ``Target``.""" with patch("dissect.target.container.open"), patch("dissect.target.target.Target.apply"): target = opener(mock_utm_dir) @@ -65,7 +65,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_utm_dir: Path) assert target.path == mock_utm_dir -def test_loader(mock_utm_dir: Path) -> None: +def test_utm_loader(mock_utm_dir: Path) -> None: loader = loader_open(mock_utm_dir) assert isinstance(loader, UtmLoader) diff --git a/tests/loaders/test_vbk.py b/tests/loaders/test_vbk.py index 05e1b17945..27b19f9b1d 100644 --- a/tests/loaders/test_vbk.py +++ b/tests/loaders/test_vbk.py @@ -28,7 +28,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_vbk(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``VbkLoader`` when opening a ``Target``.""" path = absolute_path( "_data/loaders/vbk/Backup Job 1/VBK-Test-VM.e56465c7-3a5a-4599-bc25-3555b9b8cD2025-07-20T160920_3702.vbk" @@ -52,7 +52,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: ), ], ) -def test_loader(path: str, disk_sizes: list[int]) -> None: +def test_vbk_loader(path: str, disk_sizes: list[int]) -> None: """Test the VBK loader on real files.""" path = absolute_path("_data/loaders/vbk").joinpath(path) diff --git a/tests/loaders/test_vbox.py b/tests/loaders/test_vbox.py index 587c236f75..9751519eac 100644 --- a/tests/loaders/test_vbox.py +++ b/tests/loaders/test_vbox.py @@ -21,7 +21,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: +def test_target_open_vbox(opener: Callable[[str | Path], Target], tmp_path: Path) -> None: """Test that we correctly use ``VBoxLoader`` when opening a ``Target``.""" path = tmp_path / "test.vbox" path.touch() @@ -39,7 +39,7 @@ def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) -> assert target.path == path -def test_loader(tmp_path: Path) -> None: +def test_vbox_loader(tmp_path: Path) -> None: path = tmp_path / "test.vbox" path.touch() diff --git a/tests/loaders/test_velociraptor.py b/tests/loaders/test_velociraptor.py index 597dd56cbe..27a8c7337b 100644 --- a/tests/loaders/test_velociraptor.py +++ b/tests/loaders/test_velociraptor.py @@ -62,7 +62,7 @@ def mock_velociraptor_dir(request: pytest.FixtureRequest, tmp_path: Path) -> Pat pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_velociraptor_dir: Path) -> None: +def test_target_open_velociraptor(opener: Callable[[str | Path], Target], mock_velociraptor_dir: Path) -> None: """Test that we correctly use ``VelociraptorLoader`` when opening a ``Target``.""" path = mock_velociraptor_dir diff --git a/tests/loaders/test_vma.py b/tests/loaders/test_vma.py index 5c0b950d94..d0b2245476 100644 --- a/tests/loaders/test_vma.py +++ b/tests/loaders/test_vma.py @@ -21,7 +21,7 @@ pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target]) -> None: +def test_target_open_vma(opener: Callable[[str | Path], Target]) -> None: """Test that we correctly use ``VmaLoader`` when opening a ``Target``.""" path = absolute_path("_data/loaders/vma/vzdump-qemu-6969-2025_08_01-15_24_07.vma") @@ -30,7 +30,7 @@ def test_target_open(opener: Callable[[str | Path], Target]) -> None: assert target.path == path -def test_loader() -> None: +def test_vma_loader() -> None: """Test that ``VmaLoader`` correctly loads a VMA file and its disks.""" path = absolute_path("_data/loaders/vma/vzdump-qemu-6969-2025_08_01-15_24_07.vma") diff --git a/tests/loaders/test_vmsupport.py b/tests/loaders/test_vmsupport.py index 61d2de6034..9bb019a743 100644 --- a/tests/loaders/test_vmsupport.py +++ b/tests/loaders/test_vmsupport.py @@ -47,7 +47,7 @@ def mock_vmsupport_dir(tmp_path: Path) -> Path: ("mock_vmsupport_dir", VmSupportLoader), ], ) -def test_target_open( +def test_target_open_vmsupport( opener: Callable[[str | Path], Target], path: str, loader: type[Loader], mock_vmsupport_dir: Path ) -> None: """Test that we correctly use the ESXi vm-support loaders when opening a ``Target``.""" diff --git a/tests/loaders/test_vmwarevm.py b/tests/loaders/test_vmwarevm.py index f69858cb59..70b06794dd 100644 --- a/tests/loaders/test_vmwarevm.py +++ b/tests/loaders/test_vmwarevm.py @@ -35,7 +35,7 @@ def mock_vmwarevm_dir(tmp_path: Path) -> Iterator[Path]: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_vmwarevm_dir: Path) -> None: +def test_target_open_vmwarevm(opener: Callable[[str | Path], Target], mock_vmwarevm_dir: Path) -> None: """Test that we correctly use ``VmwarevmLoader`` when opening a ``Target``.""" with patch("dissect.target.container.open"), patch("dissect.target.target.Target.apply"): target = opener(mock_vmwarevm_dir) @@ -43,7 +43,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_vmwarevm_dir: assert target.path == mock_vmwarevm_dir -def test_loader(mock_vmwarevm_dir: Path) -> None: +def test_vmwarevm_loader(mock_vmwarevm_dir: Path) -> None: """Test that ``VmwarevmLoader`` correctly loads a VMware VM directory.""" loader = loader_open(mock_vmwarevm_dir) assert isinstance(loader, VmwarevmLoader) diff --git a/tests/loaders/test_vmx.py b/tests/loaders/test_vmx.py index 90f1cde25e..ba86bed239 100644 --- a/tests/loaders/test_vmx.py +++ b/tests/loaders/test_vmx.py @@ -45,7 +45,7 @@ def mock_vmwarevm_dir(tmp_path: Path) -> Path: pytest.param(lambda x: next(Target.open_all([x])), id="target-open-all"), ], ) -def test_target_open(opener: Callable[[str | Path], Target], mock_vmwarevm_dir: Path) -> None: +def test_target_open_vmx(opener: Callable[[str | Path], Target], mock_vmwarevm_dir: Path) -> None: """Test that we correctly use ``VmwarevmLoader`` when opening a ``Target``.""" path = mock_vmwarevm_dir / "Test.vmx" @@ -55,7 +55,7 @@ def test_target_open(opener: Callable[[str | Path], Target], mock_vmwarevm_dir: assert target.path == path -def test_loader(mock_vmwarevm_dir: Path) -> None: +def test_vmx_loader(mock_vmwarevm_dir: Path) -> None: (mock_vmwarevm_dir / "mock.vmdk").touch() with _mock_vmx_and_container_open(["mock.vmdk"]) as mock_container_open: