annotate tests/__init__.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 cc2b7540fa2b
children 8341f2494b3f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import os, tempfile, sys, shutil
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3 def setUp():
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 os.environ['CDPATH'] = ''
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 os.environ['COLUMNS'] = '80'
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8 os.environ['GREP_OPTIONS'] = ''
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 os.environ['http_proxy'] = ''
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 os.environ["HGMERGE"] = "internal:merge"
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 os.environ["HGUSER"] = "test"
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 os.environ["HGENCODING"] = "ascii"
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 os.environ["HGENCODINGMODE"] = "strict"
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16 tmpdir = tempfile.mkdtemp('', 'python-hglib.')
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 os.environ["HGTMP"] = os.path.realpath(tmpdir)
71
20ffb6486412 tests: put some characters in HGRCPATH
Idan Kamara <idankk86@gmail.com>
parents: 70
diff changeset
18 os.environ["HGRCPATH"] = os.pathsep
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 def tearDown(self):
67
730c42743ba3 tests: cleanup on test finish so Windows doesn't complain about used files
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
21 os.chdir('..')
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 shutil.rmtree(os.environ["HGTMP"])