otp.TmpDir#

class TmpDir(rel_path='', *, suffix='', clean_up=True, base_dir='')#

Bases: os.PathLike

Class to create a temporary directory. By default, this directory will be deleted automatically after all references to it are gone. All files and directories under this one will be deleted too.

Base path where directories are created could be set using the ONE_TICK_TMP_DIR. By default they are created under the tempfile.gettempdir() folder.

Parameters
  • rel_path (str) – relative path to the temporary directory. If empty, then the name will be auto-generated.

  • suffix (str) – suffix of the name of the temporary directory.

  • base_dir (str) – relative path of the directory where temporary directory will be created.

  • clean_up (bool) – Controls whether this temporary directory will be deleted automatically after all references to it are gone.

See also

The testing framework has a --keep-generated flag that controls clean up for all related instances Plugin features