testing
Useful downstream testing utilities.
TmpFileManager()
A context manager for managing temporary files and directories.
Usage: with TmpFileManager() as manager: file_path = manager.tmpfile(content="Hello, temporary file!") dir_path = manager.tmp_dir()
Source code in py/bitbazaar/testing/_tmp_file_manager.py
cleanup()
tmpdir(parent=None, name=None)
Create a temporary directory.
Parameters: - parent: Optional directory to create the temporary directory in. Otherwise will be placed in root.
Returns: - The path to the created temporary directory.
Source code in py/bitbazaar/testing/_tmp_file_manager.py
tmpfile(content, suffix=None, parent=None, full_name=None)
Create a temporary file.
Parameters: - content: The content to write to the temporary file. - suffix: Optional suffix to append to the temporary file. Otherwise will be created with tempfile. - parent: Optional directory to create the temporary file in. Otherwise will be placed in root. - full_name: Optional full name of the temporary file, overrides suffix. Otherwise will be created with tempfile.
Returns: - The path to the created temporary file.
Source code in py/bitbazaar/testing/_tmp_file_manager.py
Created: August 7, 2024