Crate xvc_test_helper

source ·
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 under root. Each of these directories contain n_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 from seed. If seed is None, a random number from_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 is None, 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. The level here determines whether these are sent to stdout.