Commit 3b8b6a33 by Ben Patterson

Merge pull request #6307 from edx/benp/clean-analytics-init

Quiet analytics.init stderr output for tests.
parents 0e58e7cb f2293b95
...@@ -636,12 +636,12 @@ class CertificateItemTest(ModuleStoreTestCase): ...@@ -636,12 +636,12 @@ class CertificateItemTest(ModuleStoreTestCase):
) )
def test_refund_cert_callback_no_expiration(self): 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 # 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 # need to prevent analytics errors from appearing in stderr
with patch('sys.stderr', sys.stdout.write): 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() cart.purchase()
CourseEnrollment.unenroll(self.user, self.course_key) CourseEnrollment.unenroll(self.user, self.course_key)
...@@ -689,12 +689,11 @@ class CertificateItemTest(ModuleStoreTestCase): ...@@ -689,12 +689,11 @@ class CertificateItemTest(ModuleStoreTestCase):
expiration_datetime=(datetime.datetime.now(pytz.utc) + many_days)) expiration_datetime=(datetime.datetime.now(pytz.utc) + many_days))
course_mode.save() 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 # need to prevent analytics errors from appearing in stderr
with patch('sys.stderr', sys.stdout.write): 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() cart.purchase()
CourseEnrollment.unenroll(self.user, self.course_key) CourseEnrollment.unenroll(self.user, self.course_key)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment