rez environment for the test framework

encodingguidelines_env is the rez package with the Python environment for enctests: Python 3.11 and the packages in requirements.txt. FFmpeg is not included, so it can be picked per run.

The build script is a starting point. So far it has only been run on macOS (Apple silicon), and only with the PyPI install step skipped. The downloads, constraints.txt, Windows and Linux are all untested.

Files

File Purpose
build_env.py Builds everything on Linux, Windows or macOS
constraints.txt Versions of the indirect dependencies, taken from the macOS install
encodingguidelines_env/package.py The environment package

Requirements

  • rez, installed with its install.py, with rez on the PATH
  • Python 3.11 with pip, installed system-wide (not a virtualenv, and on Windows not the Microsoft Store version)
  • Network access to PyPI
  • Google Chrome, for the report graphs (or run kaleido_get_chrome in the built environment)
  • An FFmpeg with libvmaf and zscale, plus libdav1d or libaom to decode AV1
  • The VMAF model files (vmaf_v0.6.1.json, vmaf_4k_v0.6.1.json)

Build

Run from the repository root. Check the steps first with --dry-run.

Windows:

py -3.11 rez\build_env.py --dry-run
py -3.11 rez\build_env.py

Linux and macOS:

python3.11 rez/build_env.py --dry-run
python3.11 rez/build_env.py

Packages go into rez’s local_packages_path; use --prefix <path> for another repository. Existing packages are reused, so the script is safe to re-run after fixing a problem.

The steps are:

  1. rez bind the platform, arch and os packages, if missing.
  2. Write a python package pointing at the interpreter running the script, if there is no python-3.11 package. On Windows it adds the interpreter’s folder to the PATH; elsewhere it symlinks the interpreter.
  3. rez pip each line of requirements.txt.
  4. rez build --install the environment package.
  5. Resolve the environment and import every package.

Run the tests

VMAF_MODEL_DIR is set automatically if the models are in a usual Linux or macOS location. Windows has none, so set it yourself. A value you have already set is kept.

From the enctests folder, with FFmpeg on the PATH:

rez env encodingguidelines_env -- python -m testframework.main --test-config-dir ./test_configs --source-folder ./sources

If you have rez packages for FFmpeg, add one to the request (e.g. ffmpeg-8.1). See the enctests README for downloading source media and for the other options.

Windows: things to check

None of these have been tried. They come from reading the code.

  • The test framework splits command lines with shlex.split, which treats backslashes as escapes. Use forward slashes in FFMPEG_BIN, IDIFF_BIN and other paths you pass in, and expect trouble with paths that contain spaces.
  • ffprobe’s path is made by replacing every ffmpeg in FFMPEG_BIN with ffprobe, so a folder with ffmpeg in its name breaks it. Leaving FFMPEG_BIN unset and putting FFmpeg on the PATH avoids this.
  • Check that idiff and oiiotool, installed by the OpenImageIO wheel, run inside the environment.
  • Check that the generated python package starts the right interpreter:

    rez env encodingguidelines_env -- python -c "import sys; print(sys.executable, sys.version)"
    

For an agent setting up a new machine

  • Work through Requirements, run --dry-run, then build. Report what is missing instead of installing system software without asking.
  • If a step fails, fix build_env.py or package.py rather than editing installed packages by hand, so the fix works on the next machine. Keep Linux and macOS working.
  • Keep requirements.txt and the requires list in package.py in sync, and increase the package version when package.py changes.
  • Once built, run one small test config (--test-config) before the whole suite.
  • Commit fixes to this branch with git commit -s, and update this README with what was tested, on which OS and versions.

Copyright © 2022 ORI Contributors. Distributed under a CC BY 4.0 license.

This site uses Just the Docs, a documentation theme for Jekyll.