configglue team mailing list archive
-
configglue team
-
Mailing list archive
-
Message #00286
[Merge] lp:~ricardokirkner/configglue/mock-backwards-compat into lp:configglue
Ricardo Kirkner has proposed merging lp:~ricardokirkner/configglue/mock-backwards-compat into lp:configglue.
Requested reviews:
Configglue developers (configglue)
For more details, see:
https://code.launchpad.net/~ricardokirkner/configglue/mock-backwards-compat/+merge/68963
Overview
========
Make sure configglue can be run using any version of mock from 0.6 - 0.8, so that tests can be run using lucid's native package (in order to run the tests during package build time).
--
https://code.launchpad.net/~ricardokirkner/configglue/mock-backwards-compat/+merge/68963
Your team Configglue developers is requested to review the proposed merge of lp:~ricardokirkner/configglue/mock-backwards-compat into lp:configglue.
=== modified file 'configglue/tests/test_parser.py'
--- configglue/tests/test_parser.py 2011-07-17 22:32:16 +0000
+++ configglue/tests/test_parser.py 2011-07-23 18:46:16 +0000
@@ -32,7 +32,6 @@
from mock import (
Mock,
patch,
- patch_object,
)
from configglue.parser import (
@@ -53,6 +52,13 @@
)
+# backwards compatibility
+if not hasattr(patch, 'object'):
+ # mock < 0.8
+ from mock import patch_object
+ patch.object = patch_object
+
+
class TestIncludes(unittest.TestCase):
def setUp(self):
class MySchema(Schema):
@@ -443,7 +449,7 @@
parser = SchemaConfigParser(MySchema())
parser.readfp(config)
- with patch_object(parser, '_get_interpolation_keys',
+ with patch.object(parser, '_get_interpolation_keys',
mock_get_interpolation_keys):
value = parser._interpolate_value('__main__', 'foo')
=== modified file 'configglue/tests/test_schemaconfig.py'
--- configglue/tests/test_schemaconfig.py 2011-07-19 03:15:22 +0000
+++ configglue/tests/test_schemaconfig.py 2011-07-23 18:46:16 +0000
@@ -24,7 +24,6 @@
from mock import (
Mock,
patch,
- patch_object,
)
from configglue.glue import (
@@ -41,6 +40,13 @@
)
+# backwards compatibility
+if not hasattr(patch, 'object'):
+ # mock < 0.8
+ from mock import patch_object
+ patch.object = patch_object
+
+
class TestOption(unittest.TestCase):
cls = Option
@@ -198,7 +204,7 @@
sys.argv = _argv
def test_glue_environ_precedence(self):
- with patch_object(os, 'environ',
+ with patch.object(os, 'environ',
{'CONFIGGLUE_FOO_BAR': '42', 'BAR': '1'}):
config = StringIO("[foo]\nbar=$BAR")
Follow ups