redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.85k stars 126 forks source link

Use temporary output directory for `test_function_replacement_modifier` #484

Closed alchzh closed 1 month ago

alchzh commented 1 month ago

Currently running the test suite (specifically test_function_replacement_modifier) pollutes the current directory with these output files which the developer has to clean up to get a clean working tree. This changes it to use pytest's tmp_path fixture.

The output files from subsequent runs are saved in pytest's temporary directories like so instead of being overwritten:

ofrakdev@e9d35e42d66b:/workspaces/rbs-ofrak/ofrak$ cd /tmp/pytest-of-ofrakdev/pytest-
pytest-0/       pytest-1/       pytest-current/ 
ofrakdev@e9d35e42d66b:/workspaces/rbs-ofrak/ofrak$ cd /tmp/pytest-of-ofrakdev/pytest-1/
ofrakdev@e9d35e42d66b:/tmp/pytest-of-ofrakdev/pytest-1$ ls
test_function_replacement_modi0  test_function_replacement_modi2  test_function_replacement_modi4  test_function_replacement_modi6  test_function_replacement_modicurrent
test_function_replacement_modi1  test_function_replacement_modi3  test_function_replacement_modi5  test_function_replacement_modi7
ofrakdev@e9d35e42d66b:/tmp/pytest-of-ofrakdev/pytest-1$ ls test_function_replacement_modi0
replaced_hello.out  replaced_hello.out.lock