Merge lp:~vila/bzr/690563-test-isolation into lp:bzr
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5573 |
Proposed branch: | lp:~vila/bzr/690563-test-isolation |
Merge into: | lp:bzr |
Diff against target: |
120 lines (+23/-13) 4 files modified
bzrlib/tests/__init__.py (+7/-1) bzrlib/tests/test_http.py (+9/-9) bzrlib/tests/test_https_ca_bundle.py (+3/-3) doc/en/release-notes/bzr-2.3.txt (+4/-0) |
To merge this branch: | bzr merge lp:~vila/bzr/690563-test-isolation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel | Needs Fixing | ||
Review via email: mp+43773@code.launchpad.net |
Commit message
Fix test isolation leaks destroying env variables.
Description of the change
BZR_
suceeding while
BZR_
failing in bzrlib.
The journey was interesting...
After a painful bisection with an instrumented version revealing
that BZR_PLUGIN_PATH was deleted from os.environ somehow, I ended
up with the following suspects:
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
bzrlib.
Deleting test_all_proxy group or test_all_
group makes the bug vanish...
The nasty bug is in:
class TestProxyHttpSe
...
def setUp(self):
# Let's setup some attributes for tests
server = self.get_
if self._testing_
# Oh my ! pycurl does not check for the port as part of
# no_proxy :-( So we just test the host part
else:
# The secondary server is the proxy
The offending line is the last one, because we have:
class TestCase(
...
def _cleanEnvironme
new_env = {
...
Eerk !
So as soon as one of the proxy tests is executed all values saved by TestCase are lost. For bug #690563, BZR_PLUGIN_PATH was the whistle blower. I'm quite amazed that we didn't get more failures due to this bug so far...
So the obvious fix is to use a different variable to hold the values for the proxy tests.
While this patch is enough for the case at end, I'll propose a more robust one (but more invasive and may be even controversial) later.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/15/2010 8:45 AM, Vincent Ladeuil wrote: tests.test_ import_ tariff. TestImportTarif fs.test_ simple_ local failure /bugs.launchpad .net/bugs/ 690563 PATH=-site bzr selftest -s bt.test_ import_ tariff PATH=-site bzr selftest --parallel=fork tests.test_ import_ tariff. TestImportTarif fs.test_ simple_ local smells like a test isolation issue right ?
> Vincent Ladeuil has proposed merging lp:~vila/bzr/690563-test-isolation into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> #690563 bzrlib.
> https:/
>
>
> BZR_PLUGIN_
>
> suceeding while
>
> BZR_PLUGIN_
>
> failing in bzrlib.
>
> The journey was interesting...
>
...
I have to wonder why test_http needs its own save-and-restore env
variables. Rather than just doing it via the regular interface. Given
that they are calling "_install_env" and "_restore_env", versus the
TestCase versions.
Anyway, I''m ok with a fix like this, but maybe calling the variable:
self._http_ saved_env = {}
Would make it clearer. This is also one of the very few cases where
using a double underscore for self.__old_env would have actually been
useful. (Since they actually end up as different real names, though that
can also confuse you "why isn't it getting set")
review: needs_fixing
merge: approve
John enigmail. mozdev. org/
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk0 I688ACgkQJdeBCY SNAAPE3QCfZXe3E g1ZikWKJIUvX+ UW5cmf RPhIkB6pDkqgwfD 5d
LS0An1pLJpSNDh8
=efjP
-----END PGP SIGNATURE-----