annotate tests/test-context.py @ 21754:7e14d026c4c4

run-tests: fixes the '--interactive' option error This patch fixes a regression recently introduced by a refactoring. Previously when failure occurs while testing with '--interactive' was enable, it didn't prompt user by asking whether he wants to accept this failure changes or not. This was happening beacuse of the 'if' condition if ret or not self._options.interactive or \ not os.path.exists(test.errpath): Everytime failure occurs, this condition gets true and returns back even when '--interactive' is enabled. This condition don't led the function to execute further, which consist the '--interactive' functionality. Now, on failure with '--interactive' enabled, it prompts user whether he wants to accepts failure changes or not. If yes then test gets passed and returns true, else test gets failed. On every failure, results gets stored in "self.failures.append((test, reason))" But if failure changes accepted by user then test must get "pop out" from failed test list.
author anuraggoel <anurag.dsps@gmail.com>
date Fri, 13 Jun 2014 14:45:23 +0530
parents 503bb3af70fe
children 232038a05fdb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4110
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
1 import os
14379
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
2 from mercurial import hg, ui, context, encoding
4110
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
3
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
4 u = ui.ui()
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
5
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
6 repo = hg.repository(u, 'test1', create=1)
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
7 os.chdir('test1')
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
8
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
9 # create 'foo' with fixed time stamp
9031
3b76321aa0de compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents: 6747
diff changeset
10 f = open('foo', 'w')
4110
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
11 f.write('foo\n')
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 f.close()
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 os.utime('foo', (1000, 1000))
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
14
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15 # add+commit 'foo'
11303
a1aad8333864 move working dir/dirstate methods from localrepo to workingctx
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9031
diff changeset
16 repo[None].add(['foo'])
4110
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 repo.commit(text='commit1', date="0 0")
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18
6747
f6c00b17387c use repo[changeid] to get a changectx
Matt Mackall <mpm@selenic.com>
parents: 6740
diff changeset
19 print "workingfilectx.date =", repo[None]['foo'].date()
14379
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
20
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
21 # test memctx with non-ASCII commit message
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
22
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
23 def filectxfn(repo, memctx, path):
21689
503bb3af70fe memfilectx: call super.__init__ instead of duplicating code
Sean Farley <sean.michael.farley@gmail.com>
parents: 14379
diff changeset
24 return context.memfilectx(repo, "foo", "")
14379
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
25
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
26 ctx = context.memctx(repo, ['tip', None],
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
27 encoding.tolocal("Gr\xc3\xbcezi!"),
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
28 ["foo"], filectxfn)
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
29 ctx.commit()
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
30 for enc in "ASCII", "Latin-1", "UTF-8":
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
31 encoding.encoding = enc
bd23d5f28bbb changelog: convert user and desc from local encoding early
Martin Geisler <mg@aragost.com>
parents: 11303
diff changeset
32 print "%-8s: %s" % (enc, repo["tip"].description())