Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Predictable and repeatable tempdir support.

Project description

See Build Status on Travis CI See Build Status on AppVeyor

Adds support for a predictable and repeatable temporary directory.

This Pytest plugin was generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.


  • Adds support for a predictable and repeatable temporary directory through the tempdir fixture which gets cleaned up in the end of the test run session(this behaviour can be disabled).


  • None!


You can install “pytest-tempdir” via pip from PyPI:

$ pip install pytest-tempdir


  • Simply define a pytest_tempdir_basename function on your which returns a string to define the basename or pass --tempdir-basename.
  • If you wish to leave the temporary directory intact for further inspection after the tests suite ends, pass --tempdir-no-clean.


Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.


Distributed under the terms of the Apache 2.0 license, “pytest-tempdir” is free and open source software


If you encounter any problems, please file an issue along with a detailed description.



  • Lower log call logging level


  • Support pytest 2.x and 3.x


  • Each absolute path gets it’s own counter


  • Append a counter value to existing directory names


  • Fix more encoding issues when running setup and the system locale is not set


  • Fix encoding issue when running setup and the system locale is not set


  • Fix stale tempdir cleanup logic


  • Wipe the tempdir directory on test session start if it exists


  • First working release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pytest_tempdir-2018.8.11-py2.py3-none-any.whl (5.5 kB) Copy SHA256 hash SHA256 Wheel py2.py3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page