I want to run a test
for a function which accepts a Path
to a file as input via an argument: function(some_path_to_file)
via tox
. The file I want to pass to the function cannot be created temporarily during test setup (what I usually do via pytest
s builtin tmpdir
fixtures) but resides in the package <package>/data
directory besides the test directory <package>/tests
(the location <package>/tests/data
would probably be better). Because tox
runs the tests in a virtualenv it's not clear to me how to make the test data file available to the test. I know that I can define the base temporary directory of pytest
with the --basedir
option but I did not get it working with tox
yet.
tl;dr
The problem was a conversion of some_path_to_file
from Path
to str
(to pass it to sqlite3.connect(database
inside the function
) using Path.resolve(
. No need to configure pytests --basedir
option and tox
in any way.