From f2293b950848d3459bc0c80361f3568ec7487d2e Mon Sep 17 00:00:00 2001 From: Ben Patterson Date: Thu, 18 Dec 2014 13:21:52 -0500 Subject: [PATCH] Quiet analytics.init stderr output for tests. --- lms/djangoapps/shoppingcart/tests/test_models.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lms/djangoapps/shoppingcart/tests/test_models.py b/lms/djangoapps/shoppingcart/tests/test_models.py index d60b110f98..22dba59fe5 100644 --- a/lms/djangoapps/shoppingcart/tests/test_models.py +++ b/lms/djangoapps/shoppingcart/tests/test_models.py @@ -636,12 +636,12 @@ class CertificateItemTest(ModuleStoreTestCase): ) def test_refund_cert_callback_no_expiration(self): # When there is no expiration date on a verified mode, the user can always get a refund - CourseEnrollment.enroll(self.user, self.course_key, 'verified') - cart = Order.get_cart_for_user(user=self.user) - CertificateItem.add_to_order(cart, self.course_key, self.cost, 'verified') # need to prevent analytics errors from appearing in stderr with patch('sys.stderr', sys.stdout.write): + CourseEnrollment.enroll(self.user, self.course_key, 'verified') + cart = Order.get_cart_for_user(user=self.user) + CertificateItem.add_to_order(cart, self.course_key, self.cost, 'verified') cart.purchase() CourseEnrollment.unenroll(self.user, self.course_key) @@ -689,12 +689,11 @@ class CertificateItemTest(ModuleStoreTestCase): expiration_datetime=(datetime.datetime.now(pytz.utc) + many_days)) course_mode.save() - CourseEnrollment.enroll(self.user, self.course_key, 'verified') - cart = Order.get_cart_for_user(user=self.user) - CertificateItem.add_to_order(cart, self.course_key, self.cost, 'verified') - # need to prevent analytics errors from appearing in stderr with patch('sys.stderr', sys.stdout.write): + CourseEnrollment.enroll(self.user, self.course_key, 'verified') + cart = Order.get_cart_for_user(user=self.user) + CertificateItem.add_to_order(cart, self.course_key, self.cost, 'verified') cart.purchase() CourseEnrollment.unenroll(self.user, self.course_key)