annotate tests/test_manifest.py @ 221:a2afbf236ca8

hglib tests: remove deprecated constructions This mostly removes usage of 'assertEquals' (replaced with 'assertEqual'), as well as opening files without closing them (fixed using a 'with' statement).
author Mathias De Mare <mathias.de_mare@nokia.com>
date Thu, 09 Mar 2023 14:00:02 +0100
parents 8341f2494b3f
children
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
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 143
diff changeset
2 import hglib, os, stat
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
3 from hglib.util import b
64
a7d98dc798c5 client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4
a7d98dc798c5 client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 class test_manifest(common.basetest):
a7d98dc798c5 client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 def test_basic(self):
a7d98dc798c5 client: add manifest command
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: 69
diff changeset
8 files = [b('a')]
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
9 manifest = [(b('047b75c6d7a3ef6a2243bd0e99f94f6ea6683597'), b('644'),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
10 False, False, b('a'))]
69
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
11
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
12 if os.name == 'posix':
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
13 self.append('b', 'b')
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
14 os.chmod('b', os.stat('b')[0] | stat.S_IEXEC)
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
15 os.symlink('b', 'c')
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
16
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
17 files.extend([b('b'), b('c')])
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
18 manifest.extend([(b('62452855512f5b81522aa3895892760bb8da9f3f'),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
19 b('755'), True, False, b('b')),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
20 (b('62452855512f5b81522aa3895892760bb8da9f3f'),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
21 b('644'), False, True, b('c'))])
69
e89dd99638ce test-manifest: Windows doesn't have symlink or executable bit
Idan Kamara <idankk86@gmail.com>
parents: 64
diff changeset
22
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 69
diff changeset
23 self.client.commit(b('first'), addremove=True)
64
a7d98dc798c5 client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24
221
a2afbf236ca8 hglib tests: remove deprecated constructions
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 219
diff changeset
25 self.assertEqual(list(self.client.manifest(all=True)), files)
64
a7d98dc798c5 client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26
221
a2afbf236ca8 hglib tests: remove deprecated constructions
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 219
diff changeset
27 self.assertEqual(list(self.client.manifest()), manifest)