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 <luca.fancellu@arm.com>
Loading
Please register or sign in to comment