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§
- Build a directory tree containing
n_dirs
underroot
. Each of these directories containn_files_per_dir
random binary files. - Create a random named temp directory under $TMPDIR
- Creates a file filled with byte
- Generate a random binary file
- Generate a random text file composed of alphanumerics
- Creates a symlink from target to original
- Generates a random name with
prefix
and a random number generated fromseed
. Ifseed
isNone
, a random numberfrom_entropy
is used. - Return name of a random directory under $TMPDIR. It doesn’t create the directory, just returns the path.
- Create a temporary dir under $TMPDIR and cd to it
- Create an empty temporary Git repository without XVC_DIR
- Return a temp directory created with a seed. If
seed
isNone
, it creates a random directory name. This function doesn’t create the directory. - Create a random directory and run
git init
in it. - Turn on logging for testing purposes. Testing always send traces to
$TMPDIR/xvc.log
. Thelevel
here determines whether these are sent tostdout
.