# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

# Configuration file for tests as root.
# Call with `sudo tox -c tox_root.ini`
# Use tox_slow.ini for longer running tests and tox.ini for normal tests.

[tox]
envlist = py37, py38, py39, py310
# some directories to avoid creating files with root rights that
# couldn't be overwritten by the non-root tests:
toxworkdir = {toxinidir}/.tox.root
isolated_build_env = .package.root

[testenv]
# make sure those variables are passed down; you should define them
# either implicitly through usage of sudo (which defines the SUDO_* variables),
# or explicitly the RDIFF_* ones:
passenv = SUDO_USER, SUDO_UID, SUDO_GID, RDIFF_TEST_*, RDIFF_BACKUP_*
deps = -r{toxinidir}/requs/base.txt
       -r{toxinidir}/requs/optional.txt
#whitelist_externals = env
commands_pre =
    rdiff-backup --version
    # must be the first command to setup the test environment
    python testing/commontest.py
commands =
    python testing/roottest.py --verbose --buffer
