pytest_datafiles_python310

Pytest plugin to create a tmpdir containing a preconfigured set of files

bacaro: haikuports also on HaikuPorts
Also on HaikuPorts. pytest_datafiles_python310

Description

This plugin allows you to specify one or several files/directories that are copied to a temporary directory (tmp_path) before the execution of the test. This means the original files are not modified and every test runs on its own version of the same files.

Files/directories can be specified either as strings or as pathlib.Path objects.

To take advantage of the datafiles fixture in a test function, add datafiles as one of the test function parameters (per usual with pytest fixtures) and decorate the test function with @pytest.mark.datafiles(file1, file2, dir1, dir2, ...).

The datafiles variable in your test function is a pathlib.Path object (tmp_path) where the copied files are located.

Install

Channel stable v3.0.0-1

This app is curated in HaikuPorts. Install it from there, it is already available in HaikuDepot.

pkgman install pytest_datafiles_python310

Download version 3.0.0-1 (any) hpkg

Careful: the file comes from HaikuPorts' own server, but installing it by hand is not the way in. It is pkgman that resolves the dependencies an .hpkg does not carry with it, and a package installed on its own may simply not run. Use the pkgman command above, unless you know exactly why you want the file.

Reviews