annotate tests/test-inotify-issue1556.t @ 19933:621a26eb3a99

demandimport: allow extensions to import own modules by absolute name Before this patch, python modules of each extensions can't import another one in own extension by absolute name, because root modules of each extensions are loaded with "hgext_" prefix. For example, "import extroot.bar" in "extroot/foo.py" of "extroot" extension fails, even though "import bar" in it succeeds. Installing extensions into site-packages of python library path can avoid this problem, but this solution is not reasonable in some cases: using binary package of Mercurial on Windows, for example. This patch retries to import with "hgext_" prefix after ImportError, if the module in the extension may try to import another one in own extension. This patch doesn't change some "_import()"/"_origimport()" invocations below, because ordinary extensions shouldn't cause such invocations. - invocation of "_import()" when root module imports sub-module by absolute path without "fromlist" for example, "import a.b" in "a.__init__.py". extensions are loaded with "hgext_" prefix, and this causes execution of another (= fixed by this patch) code path. - invocation of "_origimport()" when "level != -1" with "fromlist" for example, importing after "from __future__ import absolute_import" (level == 0), or "from . import b" or "from .a import b" (0 < level), for portability between python versions and environments, extensions shouldn't cause "level != -1".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 05 Oct 2013 01:02:22 +0900
parents 895d65364570
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
1
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
2 $ "$TESTDIR/hghave" inotify || exit 80
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
3 $ hg init
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
4 $ touch a b
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
5 $ hg add a b
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
6 $ rm b
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
7
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
8 status without inotify
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
9
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
10 $ hg st
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
11 A a
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
12 ! b
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
13 $ echo "[extensions]" >> $HGRCPATH
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
14 $ echo "inotify=" >> $HGRCPATH
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
15
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
16 inserve
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
17
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
18 $ hg inserve -d --pid-file=hg.pid 2>&1
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
19 $ cat hg.pid >> "$DAEMON_PIDS"
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
20
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
21 status
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
22
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
23 $ hg st
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
24 A a
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
25 ! b
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
26 ? hg.pid
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
27 $ sleep 1
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
28
12456
1f74b0d0f485 tests: unify test-inotify-issue1556
Matt Mackall <mpm@selenic.com>
parents: 8601
diff changeset
29 Are we able to kill the service? if not, the service died on some error
8601
021de2d12355 inotify: adding test for issue1556
Dmitriy Kostunin <dmitriy.kostunin@gmail.com>
parents:
diff changeset
30
18593
895d65364570 test-inotify-issue1556.t: migrate to killdaemons from kill `cat pidfile`
Augie Fackler <raf@durin42.com>
parents: 12456
diff changeset
31 $ "$TESTDIR/killdaemons.py" hg.pid