tests/README
author Thomas Arendsen Hein <thomas@intevation.de>
Tue, 22 Aug 2006 10:08:42 +0200
changeset 2990 61fcd9fac434
parent 2935 1c66aad252f9
child 2991 f63667f694de
permissions -rw-r--r--
Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc and add documentation for this.

A simple testing framework

To run the tests, do:

cd tests/
python run-tests.py

This finds all scripts in the test directory named test-* and executes
them. The scripts can be either shell scripts or Python. Each test is
run in a temporary directory that is removed when the test is complete.

A test-<x> succeeds if the script returns success and its output
matches test-<x>.out. If the new output doesn't match, it is stored in
test-<x>.err.

There are some tricky points here that you should be aware of when
writing tests:

- hg commit and hg merge want user interaction

  for commit use -m "text"
  for hg merge, set HGMERGE to something noninteractive (like true or merge)

- changeset hashes will change based on user and date which make
  things like hg history output change

  use commit -m "test" -u test -d "1000000 0"

- diff will show the current time

  use hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
                    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
  to strip dates

- You can append your own hgrc settings to the file that the environment
  variable HGRCPATH points to. This file is cleared before running a test.