sapling/tests/test-check-config.t
Adam Simpkins 55a457de69 tests: use the system hg for examining the local repository
Most test scripts use "hg" to interact with a temporary test repository.
However a few tests also want to run hg commands to interact with the local
repository containing the mercurial source code.  Notably, many of the
test-check-* tests want to check local files and commit messages.

These tests were previously using the version of hg being tested to query the
source repository.  However, this will fail if the source repository requires
extensions or other settings not supported by the version of mercurial being
tested.  The source repository was typically initially cloned using the system
hg installation, so we should use the system hg installation to query it.

There was already a helpers-testrepo.sh script designed to help cope with
different requirements for the source repository versus the test repositories.
However, it only handled the evolve extension.  This new behavior works with
any extensions that are different between the system installation and the test
installation.
2017-06-27 17:24:31 -07:00

39 lines
1.1 KiB
Raku

#require test-repo
$ . "$TESTDIR/helpers-testrepo.sh"
Sanity check check-config.py
$ cat > testfile.py << EOF
> # Good
> foo = ui.config('ui', 'username')
> # Missing
> foo = ui.config('ui', 'doesnotexist')
> # Missing different type
> foo = ui.configint('ui', 'missingint')
> # Missing with default value
> foo = ui.configbool('ui', 'missingbool1', default=True)
> foo = ui.configbool('ui', 'missingbool2', False)
> EOF
$ cat > files << EOF
> mercurial/help/config.txt
> $TESTTMP/testfile.py
> EOF
$ cd "$TESTDIR"/..
$ $PYTHON contrib/check-config.py < $TESTTMP/files
undocumented: ui.doesnotexist (str)
undocumented: ui.missingbool1 (bool) [True]
undocumented: ui.missingbool2 (bool)
undocumented: ui.missingint (int)
New errors are not allowed. Warnings are strongly discouraged.
$ syshg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
> $PYTHON contrib/check-config.py
limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05)
conflict on profiling.showmin: ('with', '0.05') != ('with', '0.005')