Skip to content
Commit fa85bf2e authored by Luca Fancellu's avatar Luca Fancellu
Browse files

test: Use tmp_path_factory pytest fixture



Currently the tests are creating and deleting a temporary folder in
the same path of the test, it is not a common practice to perform
write operation from the test environment on the test source
structure and it is a limitation for example when the tests are
read from a readonly filesystem.

To overcome this issue, pytest exposes a special framework called
'tmp_path_factory' which is used to create and manage temporary
folders, the framework also keeps 3 history copies of them and
manages the rotation. More info about that in the pytest docs.

So use tmp_path_factory in a test fixture that exposes a variable
called 'test_dir' that generates a folder named after the test,
use such variable in the tests that needs to write on a temporary
folder and while there, remove unused import and list them
alphabetically.

Signed-off-by: Luca Fancellu's avatarLuca Fancellu <luca.fancellu@arm.com>
parent 0ef01a06
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment