annotate tests/test-log.py @ 197:6949fc164439 2.5

hgclient: look for an open server before closing it in ResponseError block At least some of the codepaths that can throw a ResponseError close the server first (the one in _readchannel does so in order to detect server startup failures, for example), so we have to verify we have a server to close before doing so, otherwise we can lose the ResponseError and the user sees an AttributeError when we try to use .close() on a NoneType.
author Augie Fackler <raf@durin42.com>
date Sun, 10 Dec 2017 12:52:37 -0500
parents 32e8d51ec16c
children 2d0ec6097d78
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 143
diff changeset
1 from tests import common
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2 import hglib
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
3 from hglib.util import b
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 class test_log(common.basetest):
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 def test_basic(self):
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
8 rev0, node0 = self.client.commit(b('first'), addremove=True)
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
10 rev1, node1 = self.client.commit(b('second'))
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 revs = self.client.log()
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 revs.reverse()
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 self.assertTrue(len(revs) == 2)
15
f1af31960414 client: change return value of commit() to (rev, node)
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
16 self.assertEquals(revs[1].node, node1)
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
18 self.assertEquals(revs[0], self.client.log(b('0'))[0])
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
19 self.assertEquals(self.client.log(), self.client.log(files=[b('a')]))
110
c635e6e7054f context: raise same error when not found for all hg versions
Alexander Plavin <me@aplavin.ru>
parents: 17
diff changeset
20
120
5d3783aebe5f log: fix 'hidden' option
Julien Cristau <julien.cristau@logilab.fr>
parents: 110
diff changeset
21 self.assertEquals(self.client.log(), self.client.log(hidden=True))
5d3783aebe5f log: fix 'hidden' option
Julien Cristau <julien.cristau@logilab.fr>
parents: 110
diff changeset
22
193
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
23 def test_dash_in_filename(self):
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
24 self.append('-a', '-a')
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
25 self.client.commit(b('first'), addremove=True)
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
26 revs = self.client.log(files=[b('-a')])
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
27 self.assertTrue(len(revs) == 1)
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
28 self.assertEquals(revs[0].rev, b('0'))
32e8d51ec16c util: make cmdbuilder() robust for faulty parsing of early options
Yuya Nishihara <yuya@tcha.org>
parents: 148
diff changeset
29
110
c635e6e7054f context: raise same error when not found for all hg versions
Alexander Plavin <me@aplavin.ru>
parents: 17
diff changeset
30 # def test_errors(self):
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 120
diff changeset
31 # self.assertRaisesRegexp(CommandError, 'abort: unknown revision',
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 120
diff changeset
32 # self.client.log, 'foo')
110
c635e6e7054f context: raise same error when not found for all hg versions
Alexander Plavin <me@aplavin.ru>
parents: 17
diff changeset
33 # self.append('a', 'a')
c635e6e7054f context: raise same error when not found for all hg versions
Alexander Plavin <me@aplavin.ru>
parents: 17
diff changeset
34 # self.client.commit('first', addremove=True)
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 120
diff changeset
35 # self.assertRaisesRegexp(CommandError,
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 120
diff changeset
36 # 'abort: unknown revision',
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 120
diff changeset
37 # self.client.log, 'bar')