Reputation: 4546
I am trying to create a temporary directory in a drive other than the C Drive using pytest.
The normal way to create a temporary drive ac according to my knowledge is as below:
@pytest.fixture
def copy_path_file(qtbot, request, tmpdir):
"""Setup Project widget."""
directory = request.node.get_marker('change_directory')
if directory:
project_dir = to_text_string(tmpdir.mkdir('project'))
else:
project_dir = None
The temporary drive using this method is created in drive C. of the windows system drive, but I want to create a temporary drive in D, for example.
Does anyone have experience with pytest? Thanks in advance.
Upvotes: 2
Views: 369
Reputation: 8644
From the pytest documentation:
The default base temporary directory
Temporary directories are by default created as sub-directories of the system temporary directory. The base name will be
pytest-NUM
whereNUM
will be incremented with each test run. Moreover, entries older than 3 temporary directories will be removed.You can override the default temporary directory setting like this:
pytest --basetemp=mydir
When distributing tests on the local machine,
pytest
takes care to configure a basetemp directory for the sub processes such that all temporary data lands below a single per-test run basetemp directory.
Upvotes: 5