Debian Codegraph @

tests/test-hghave.t

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 $ . "$TESTDIR/helpers-testrepo.sh"
2
3 $ . "$TESTDIR/helper-runtests.sh"
4
5 Testing that hghave does not crash when checking features
6
7 $ hghave --test-features 2>/dev/null
8
9 Testing hghave extensibility for third party tools
10
11 $ cat > hghaveaddon.py <<EOF
12 > import hghave
13 > @hghave.check("custom", "custom hghave feature")
14 > def has_custom():
15 > return True
16 > EOF
17
18 (invocation via run-tests.py)
19
20 $ cat > test-hghaveaddon.t <<EOF
21 > #require custom
22 > $ echo foo
23 > foo
24 > EOF
25
26 #if windows
27 $ MAYBE_PURE=""
28 #else
29 We use --pure install to avoid doing a full build and install of Mercurial in
30 the middle of the test (and the associated dependencies). We need to not do
31 that on windows as mixing --pure with non-pure run confuse runtests.py as
32 `hg.bat` is expected instead of `hg.exe`. Since this is not the core of what is
33 tested here, we work around the issue for now.
34 $ MAYBE_PURE="--pure"
35 #endif
36
37
38 $ ( \
39 > testrepohgenv; \
40 > "$PYTHON" $TESTDIR/run-tests.py \
41 > --with-hg=$HGTEST_REAL_HG $MAYBE_PURE\
42 > --jobs 1 \
43 > test-hghaveaddon.t \
44 > )
45 installed Mercurial in * seconds (glob) (?)
46 running 1 tests using 1 parallel processes
47 .
48 # Ran 1 tests, 0 skipped, 0 failed.
49
50 (invocation via command line)
51
52 $ unset TESTDIR
53 $ hghave custom
54
55 (terminate with exit code 2 at failure of importing hghaveaddon.py)
56
57 $ rm hghaveaddon.*
58 $ cat > hghaveaddon.py <<NO_CHECK_EOF
59 > importing this file should cause syntax error
60 > NO_CHECK_EOF
61
62 $ hghave custom
63 failed to import hghaveaddon.py from '.': invalid syntax (hghaveaddon.py, line 1)
64 [2]