Mercurial > public > mercurial-scm > python-hglib
annotate tests/test-hglib.py @ 127:53387d1e620b
client: connect to repo if necessary when using "with" statement
While the '__exit__' closes the connection to the server, the __enter__ method
does not open it. Without this patch, a disconnected repo cannot be used with a
context managed unless you explicitely call the "open" method.
author | Paul Tonelli <paul.tonelli@logilab.fr> |
---|---|
date | Mon, 16 Jun 2014 18:29:06 +0200 |
parents | d1f57f162274 |
children | 1b47146a4a2c |
rev | line source |
---|---|
62
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 import common, hglib |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 class test_hglib(common.basetest): |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 def setUp(self): |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 pass |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
7 def test_close_fds(self): |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 """ |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 A weird Python bug that has something to do to inherited file descriptors, |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 see http://bugs.python.org/issue12786 |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
11 """ |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
12 common.basetest.setUp(self) |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
13 client2 = hglib.open() |
d1f57f162274
closefds on posix when using subprocess
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 self.client.close() |