From 015a1344e0cf41387ec2c699b6b8ec734901905e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 28 Nov 2011 14:46:13 +0100 Subject: [PATCH] Fix Transaction.start to use keyword argument for context (transplanted from d2f919d970fb08f0da63127fc7e2f2bfd4919a27) --- tests/test_product.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_product.py b/tests/test_product.py index 63c7adec53..753e24db22 100644 --- a/tests/test_product.py +++ b/tests/test_product.py @@ -41,7 +41,8 @@ class ProductTestCase(unittest.TestCase): ''' Test uom non_zero_rate_factor constraint. ''' - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, + context=CONTEXT) as transaction: category_id = self.uom_category.create({'name': 'Test'}) transaction.cursor.commit() @@ -83,7 +84,8 @@ class ProductTestCase(unittest.TestCase): ''' Test uom check_factor_and_rate constraint. ''' - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, + context=CONTEXT) as transaction: category_id = self.uom_category.search([ ('name', '=', 'Test'), ], limit=1)[0] @@ -123,7 +125,7 @@ class ProductTestCase(unittest.TestCase): ('centimeter', 'rate'), ('Foot', 'factor'), ] - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, context=CONTEXT): for name, result in tests: uom_id = self.uom.search([ ('name', '=', name), @@ -143,7 +145,7 @@ class ProductTestCase(unittest.TestCase): ('Second', 25, 'Hour', 0.0069444444444444441, 0.01), ('Millimeter', 3, 'Inch', 0.11811023622047245, 0.12), ] - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, context=CONTEXT): for from_name, qty, to_name, result, rounded_result in tests: from_uom = self.uom.browse(self.uom.search( [ @@ -176,7 +178,7 @@ class ProductTestCase(unittest.TestCase): ('Second', Decimal('25'), 'Hour', Decimal('90000')), ('Millimeter', Decimal('3'), 'Inch', Decimal('76.2')), ] - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, context=CONTEXT): for from_name, price, to_name, result in tests: from_uom = self.uom.browse(self.uom.search( [