launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00434
[Merge] lp:~abentley/launchpad/no-proxy-warnings into lp:launchpad/devel
Aaron Bentley has proposed merging lp:~abentley/launchpad/no-proxy-warnings into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
= Summary =
Disable proxy warnings except when explicitly enabled.
== Proposed fix ==
When the environment variable 'PROXY_WARNINGS' is set to '1', emit warnings.
When it is unset or set to other values, emit no warnings.
== Pre-implementation notes ==
Discussed disabling on list. Julian Edwards and Robert Collins were positive
about it.
== Implementation details ==
None
== Tests ==
bin/test test_linkedbranch
PROXY_WARNINGS=1 bin/test test_linkedbranch
== Demo and Q/A ==
None
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/testing/factory.py
./lib/lp/testing/factory.py
32: redefinition of unused 'os' from line 31
--
https://code.launchpad.net/~abentley/launchpad/no-proxy-warnings/+merge/31781
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/no-proxy-warnings into lp:launchpad/devel.
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-08-04 00:41:14 +0000
+++ lib/lp/testing/factory.py 2010-08-04 20:17:44 +0000
@@ -28,6 +28,7 @@
from email.mime.multipart import MIMEMultipart
from itertools import count
from operator import isSequenceType
+import os
import os.path
from random import randint
from StringIO import StringIO
@@ -2858,7 +2859,7 @@
def __getattr__(self, name):
attr = getattr(self._factory, name)
- if callable(attr):
+ if os.environ.get('PROXY_WARNINGS') == '1' and callable(attr):
def guarded_method(*args, **kw):
result = attr(*args, **kw)
@@ -2881,5 +2882,6 @@
This function should only be used in legacy tests which fail because
they expect unproxied objects.
"""
- warnings.warn(ShouldThisBeUsingRemoveSecurityProxy(obj), stacklevel=2)
+ if os.environ.get('PROXY_WARNINGS') == '1':
+ warnings.warn(ShouldThisBeUsingRemoveSecurityProxy(obj), stacklevel=2)
return removeSecurityProxy(obj)
Follow ups