From 9036e0b85f06acc87011f6000eeea2b7e9165608 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Wed, 2 Apr 2025 22:16:33 +0200 Subject: [PATCH] appium: Autogen appropriate test image filenames --- appium-tests/tests/test_qemu.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appium-tests/tests/test_qemu.py b/appium-tests/tests/test_qemu.py index af9e4a4..1795bb7 100644 --- a/appium-tests/tests/test_qemu.py +++ b/appium-tests/tests/test_qemu.py @@ -56,11 +56,11 @@ def unplug_and_reconnect_usb( @pytest.fixture(scope="function") -def random_image_file(driver: appium.webdriver.Remote) -> Generator[tuple[str, bytes], None, None]: +def random_image_file(driver: appium.webdriver.Remote, request) -> Generator[tuple[str, bytes], None, None]: size_bytes = 10 * 1024 * 1024 # 10 MB payload = os.urandom(size_bytes) - remote_path = tempfile.mktemp(prefix="etchdroid_test_random_image_", suffix=".iso", dir="/sdcard/Download/") + remote_path = tempfile.mktemp(prefix=f"etchdroid_{request.node.name}_", suffix=".iso", dir="/sdcard/Download/") execute_script( driver, "mobile: pushFile", @@ -75,13 +75,13 @@ def random_image_file(driver: appium.webdriver.Remote) -> Generator[tuple[str, b run_adb_command(driver, "rm", "-f", remote_path) -@pytest.fixture(scope="session") -def raw_disk_image(qemu: QEMUController): +@pytest.fixture(scope="function") +def raw_disk_image(qemu: QEMUController, request): with tempfile.TemporaryDirectory("etchdroid_qemu_test") as tmp_path: tmp_path = Path(tmp_path) size_bytes = 50 * 1024 * 1024 # 50 MB - filename = tmp_path / "etchdroid_test_raw_disk_image.img" + filename = tmp_path / f"etchdroid_{request.node.name}.img" # Write random data to the image to catch more bugs with open(filename, "wb") as f: