Expand description
Helper functions to create random temporary directories, random binary or text files, and set logging in unit/integration tests. The directories may be initialized as Git or Xvc repositories.
Functions§
- create_
directory_ tree - Build a directory tree containing
n_dirsunderroot. Each of these directories containn_files_per_dirrandom binary files. - create_
temp_ dir - Create a random named temp directory under $TMPDIR
- generate_
filled_ file - Creates a file filled with byte
- generate_
random_ file - Generate a random binary file
- generate_
random_ text_ file - Generate a random text file composed of alphanumerics
- make_
symlink - Creates a symlink from target to original
- random_
dir_ name - Generates a random name with
prefixand a random number generated fromseed. IfseedisNone, a random numberfrom_entropyis used. - random_
temp_ dir - Return name of a random directory under $TMPDIR. It doesn’t create the directory, just returns the path.
- run_
in_ temp_ dir - Create a temporary dir under $TMPDIR and cd to it
- run_
in_ temp_ git_ dir - Create an empty temporary Git repository without XVC_DIR
- seeded_
temp_ dir - Return a temp directory created with a seed.
If
seedisNone, it creates a random directory name. This function doesn’t create the directory. - temp_
git_ dir - Create a random directory and run
git initin it. - test_
logging - Turn on logging for testing purposes.
Testing always send traces to
$TMPDIR/xvc.log. Thelevelhere determines whether these are sent tostdout.