From dc47b07f65b7c530f1290ce63b79233ee3267511 Mon Sep 17 00:00:00 2001 From: Albert Zhang Date: Wed, 17 Jul 2024 15:47:35 -0400 Subject: [PATCH] Use temporary output directory for `test_function_replacement_modifier` (#484) * Use temporary output directory for function replacement test * Use pathlib joining for file path --- .../test_ofrak/components/test_patch_maker_component.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ofrak_core/test_ofrak/components/test_patch_maker_component.py b/ofrak_core/test_ofrak/components/test_patch_maker_component.py index f35507324..e265ff77c 100644 --- a/ofrak_core/test_ofrak/components/test_patch_maker_component.py +++ b/ofrak_core/test_ofrak/components/test_patch_maker_component.py @@ -184,7 +184,7 @@ class FunctionReplacementTestCaseConfig: @pytest.mark.parametrize("config", TEST_CASE_CONFIGS) -async def test_function_replacement_modifier(ofrak_context: OFRAKContext, config): +async def test_function_replacement_modifier(ofrak_context: OFRAKContext, config, tmp_path): root_resource = await ofrak_context.create_root_resource_from_file(config.program.path) await root_resource.unpack_recursively() target_program = await root_resource.view_as(Program) @@ -230,7 +230,7 @@ async def test_function_replacement_modifier(ofrak_context: OFRAKContext, config ) await target_program.resource.run(FunctionReplacementModifier, function_replacement_config) - new_program_path = f"replaced_{Path(config.program.path).name}" + new_program_path = str(tmp_path / f"replaced_{Path(config.program.path).name}") # When running tests in parallel, do this one at a time lock = filelock.FileLock(new_program_path + ".lock")