sapling/tests/test-check-config.t
Gregory Szorc 768455e422 profiling: allow configuring minimum display threshold for hotpath
statprof.display_hotpath() accepts a "limit" function to choose the
minimum threshold for samples to display. The default is 0.05, which
means you don't need individual items contributing less than 5%.

I had a need to adjust this threshold. We already have a config
option for it. So let's reuse it.

check-config.py doesn't like having multiple defaults for the
ui.configwith() calls. The behavior is obviously correct. I'm
not sure if it is worth teaching check-config.py how to ignore
this. So I've just accepted the new output.
2017-06-15 11:10:51 -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.
$ hg 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')