Old style exceptions --> new style for Python 3
This commit is contained in:
@@ -109,7 +109,7 @@ def reorder_tabs_handler(course_item, request):
|
||||
# validate the tabs to make sure everything is Ok (e.g., did the client try to reorder unmovable tabs?)
|
||||
try:
|
||||
CourseTabList.validate_tabs(new_tab_list)
|
||||
except InvalidTabsException, exception:
|
||||
except InvalidTabsException as exception:
|
||||
return JsonResponse(
|
||||
{"error": u"New list of tabs is not valid: {0}.".format(str(exception))}, status=400
|
||||
)
|
||||
|
||||
@@ -442,7 +442,7 @@ class CourseModeViewTest(CatalogIntegrationMixin, UrlResetMixin, ModuleStoreTest
|
||||
for mode in ["honor", "verified"]:
|
||||
CourseModeFactory(mode_slug=mode, course_id=self.course.id)
|
||||
|
||||
self.course.enrollment_end = datetime(2015, 01, 01)
|
||||
self.course.enrollment_end = datetime(2015, 1, 1)
|
||||
modulestore().update_item(self.course, self.user.id)
|
||||
|
||||
url = reverse('course_modes_choose', args=[unicode(self.course.id)])
|
||||
|
||||
@@ -9,8 +9,8 @@ from track.utils import DateTimeJSONEncoder
|
||||
|
||||
class TestDateTimeJSONEncoder(TestCase):
|
||||
def test_datetime_encoding(self):
|
||||
a_naive_datetime = datetime(2012, 05, 01, 07, 27, 10, 20000)
|
||||
a_tz_datetime = datetime(2012, 05, 01, 07, 27, 10, 20000, tzinfo=UTC)
|
||||
a_naive_datetime = datetime(2012, 5, 1, 7, 27, 10, 20000)
|
||||
a_tz_datetime = datetime(2012, 5, 1, 7, 27, 10, 20000, tzinfo=UTC)
|
||||
a_date = a_naive_datetime.date()
|
||||
an_iso_datetime = '2012-05-01T07:27:10.020000+00:00'
|
||||
an_iso_date = '2012-05-01'
|
||||
|
||||
@@ -54,7 +54,7 @@ def parse_xreply(xreply):
|
||||
"""
|
||||
try:
|
||||
xreply = json.loads(xreply)
|
||||
except ValueError, err:
|
||||
except ValueError as err:
|
||||
log.error(err)
|
||||
return (1, 'unexpected reply from server')
|
||||
|
||||
@@ -135,11 +135,11 @@ class XQueueInterface(object):
|
||||
response = self.session.post(
|
||||
url, data=data, files=files, timeout=(CONNECT_TIMEOUT, READ_TIMEOUT)
|
||||
)
|
||||
except requests.exceptions.ConnectionError, err:
|
||||
except requests.exceptions.ConnectionError as err:
|
||||
log.error(err)
|
||||
return (1, 'cannot connect to server')
|
||||
|
||||
except requests.exceptions.ReadTimeout, err:
|
||||
except requests.exceptions.ReadTimeout as err:
|
||||
log.error(err)
|
||||
return (1, 'failed to read from the server')
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ def lc_choose(index, *args):
|
||||
'''
|
||||
try:
|
||||
return args[int(index) - 1]
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
pass
|
||||
if len(args):
|
||||
return args[0]
|
||||
|
||||
@@ -451,7 +451,7 @@ class formula(object):
|
||||
try:
|
||||
cmml = self.cmathml
|
||||
xml = etree.fromstring(str(cmml))
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
if 'conversion from Presentation MathML to Content MathML was not successful' in cmml:
|
||||
msg = "Illegal math expression"
|
||||
else:
|
||||
@@ -538,7 +538,7 @@ class formula(object):
|
||||
args = [self.make_sympy(expr) for expr in xml[1:]]
|
||||
try:
|
||||
res = op(*args)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.args = args # pylint: disable=attribute-defined-outside-init
|
||||
self.op = op # pylint: disable=attribute-defined-outside-init, invalid-name
|
||||
raise Exception('[formula] error=%s failed to apply %s to args=%s' % (err, opstr, args))
|
||||
|
||||
@@ -46,7 +46,7 @@ def symmath_check_simple(expect, ans, adict={}, symtab=None, extra_options=None)
|
||||
abcsym=options['__ABC__'],
|
||||
symtab=symtab,
|
||||
)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
return {'ok': False,
|
||||
'msg': 'Error %s<br/>Failed in evaluating check(%s,%s)' % (err, expect, ans)
|
||||
}
|
||||
@@ -92,22 +92,22 @@ def check(expect, given, numerical=False, matrix=False, normphase=False, abcsym=
|
||||
|
||||
try:
|
||||
xgiven = my_sympify(given, normphase, matrix, do_qubit=do_qubit, abcsym=abcsym, symtab=symtab)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
return {'ok': False, 'msg': 'Error %s<br/> in evaluating your expression "%s"' % (err, given)}
|
||||
|
||||
try:
|
||||
xexpect = my_sympify(expect, normphase, matrix, do_qubit=do_qubit, abcsym=abcsym, symtab=symtab)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
return {'ok': False, 'msg': 'Error %s<br/> in evaluating OUR expression "%s"' % (err, expect)}
|
||||
|
||||
if 'autonorm' in flags: # normalize trace of matrices
|
||||
try:
|
||||
xgiven /= xgiven.trace()
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
return {'ok': False, 'msg': 'Error %s<br/> in normalizing trace of your expression %s' % (err, to_latex(xgiven))}
|
||||
try:
|
||||
xexpect /= xexpect.trace()
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
return {'ok': False, 'msg': 'Error %s<br/> in normalizing trace of OUR expression %s' % (err, to_latex(xexpect))}
|
||||
|
||||
msg = 'Your expression was evaluated as ' + to_latex(xgiven)
|
||||
@@ -208,7 +208,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
|
||||
# parse expected answer
|
||||
try:
|
||||
fexpect = my_sympify(str(expect), matrix=do_matrix, do_qubit=do_qubit)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
msg += '<p>Error %s in parsing OUR expected answer "%s"</p>' % (err, expect)
|
||||
return {'ok': False, 'msg': make_error_message(msg)}
|
||||
|
||||
@@ -216,7 +216,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
|
||||
# if expected answer is a number, try parsing provided answer as a number also
|
||||
try:
|
||||
fans = my_sympify(str(ans), matrix=do_matrix, do_qubit=do_qubit)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
fans = None
|
||||
|
||||
# do a numerical comparison if both expected and answer are numbers
|
||||
@@ -243,7 +243,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
|
||||
# convert mathml answer to formula
|
||||
try:
|
||||
mmlans = dynamath[0] if dynamath else None
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
mmlans = None
|
||||
if not mmlans:
|
||||
return {'ok': False, 'msg': '[symmath_check] failed to get MathML for input; dynamath=%s' % dynamath}
|
||||
@@ -255,7 +255,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
|
||||
try:
|
||||
fsym = f.sympy
|
||||
msg += '<p>You entered: %s</p>' % to_latex(f.sympy)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
log.exception("Error evaluating expression '%s' as a valid equation", ans)
|
||||
msg += "<p>Error in evaluating your expression '%s' as a valid equation</p>" % (ans)
|
||||
if "Illegal math" in str(err):
|
||||
@@ -298,7 +298,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
|
||||
except sympy.ShapeError:
|
||||
msg += "<p>Error - your input vector or matrix has the wrong dimensions"
|
||||
return {'ok': False, 'msg': make_error_message(msg)}
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
msg += "<p>Error %s in comparing expected (a list) and your answer</p>" % str(err).replace('<', '<')
|
||||
if DEBUG:
|
||||
msg += "<p/><pre>%s</pre>" % traceback.format_exc()
|
||||
@@ -309,7 +309,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
|
||||
#fexpect = fexpect.simplify()
|
||||
try:
|
||||
diff = (fexpect - fsym)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
diff = None
|
||||
|
||||
if DEBUG:
|
||||
|
||||
@@ -455,7 +455,7 @@ class ContentStore(object):
|
||||
|
||||
self.save(thumbnail_content)
|
||||
|
||||
except Exception, exc: # pylint: disable=broad-except
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# log and continue as thumbnails are generally considered as optional
|
||||
logging.exception(
|
||||
u"Failed to generate thumbnail for {0}. Exception: {1}".format(content.location, str(exc))
|
||||
|
||||
@@ -196,7 +196,7 @@ class ToyCourseFactory(SampleCourseFactory):
|
||||
'graded': True,
|
||||
'discussion_topics': {"General": {"id": "i4x-edX-toy-course-2012_Fall"}},
|
||||
'graceperiod': datetime.timedelta(days=2, seconds=21599),
|
||||
'start': datetime.datetime(2015, 07, 17, 12, tzinfo=pytz.utc),
|
||||
'start': datetime.datetime(2015, 7, 17, 12, tzinfo=pytz.utc),
|
||||
'xml_attributes': {"filename": ["course/2012_Fall.xml", "course/2012_Fall.xml"]},
|
||||
'pdf_textbooks': [
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ class BasketsView(APIView):
|
||||
try:
|
||||
course_key = CourseKey.from_string(course_id)
|
||||
courses.get_course(course_key)
|
||||
except (InvalidKeyError, ValueError)as ex:
|
||||
except (InvalidKeyError, ValueError) as ex:
|
||||
log.exception(u'Unable to locate course matching %s.', course_id)
|
||||
return False, None, text_type(ex)
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class CommandsTestBase(SharedModuleStoreTestCase):
|
||||
|
||||
try:
|
||||
output = self.call_command('dump_course_structure', *args, **kwargs)
|
||||
except TypeError, exception:
|
||||
except TypeError as exception:
|
||||
self.fail(exception)
|
||||
|
||||
dump = json.loads(output)
|
||||
|
||||
@@ -285,7 +285,7 @@ def _add_timed_exam_info(user, course, section, section_context):
|
||||
unicode(course.id),
|
||||
unicode(section.location)
|
||||
)
|
||||
except Exception, ex: # pylint: disable=broad-except
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
# safety net in case something blows up in edx_proctoring
|
||||
# as this is just informational descriptions, it is better
|
||||
# to log and continue (which is safe) than to have it be an
|
||||
|
||||
@@ -489,7 +489,7 @@ class ProfileImageTestMixin(object):
|
||||
Mixin with utility methods for user profile image
|
||||
"""
|
||||
|
||||
TEST_PROFILE_IMAGE_UPLOADED_AT = datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC)
|
||||
TEST_PROFILE_IMAGE_UPLOADED_AT = datetime(2002, 1, 9, 15, 43, 1, tzinfo=UTC)
|
||||
|
||||
def create_profile_image(self, user, storage):
|
||||
"""
|
||||
|
||||
@@ -770,9 +770,9 @@ def upload(request, course_id): # ajax upload file to a question or answer
|
||||
max_file_size=cc_settings.MAX_UPLOAD_FILE_SIZE
|
||||
)
|
||||
|
||||
except exceptions.PermissionDenied, err:
|
||||
except exceptions.PermissionDenied as err:
|
||||
error = unicode(err)
|
||||
except Exception, err: # pylint: disable=broad-except
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
print(err)
|
||||
logging.critical(unicode(err))
|
||||
error = _('Error uploading file. Please contact the site administrator. Thank you.')
|
||||
|
||||
@@ -671,13 +671,13 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
|
||||
u"quote": u"quote text1",
|
||||
u"text": u"text1",
|
||||
u"usage_id": unicode(self.html_module_1.location),
|
||||
u"updated": datetime(2016, 01, 26, 8, 5, 16, 00000).isoformat(),
|
||||
u"updated": datetime(2016, 1, 26, 8, 5, 16, 00000).isoformat(),
|
||||
},
|
||||
{
|
||||
u"quote": u"quote text2",
|
||||
u"text": u"text2",
|
||||
u"usage_id": unicode(self.html_module_2.location),
|
||||
u"updated": datetime(2016, 01, 26, 9, 6, 17, 00000).isoformat(),
|
||||
u"updated": datetime(2016, 1, 26, 9, 6, 17, 00000).isoformat(),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -695,7 +695,7 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
|
||||
u'text': u'text1',
|
||||
u'quote': u'quote text1',
|
||||
u'usage_id': unicode(self.html_module_1.location),
|
||||
u'updated': datetime(2016, 01, 26, 8, 5, 16)
|
||||
u'updated': datetime(2016, 1, 26, 8, 5, 16)
|
||||
},
|
||||
{
|
||||
'section': {},
|
||||
@@ -708,7 +708,7 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
|
||||
u'text': u'text2',
|
||||
u'quote': u'quote text2',
|
||||
u'usage_id': unicode(self.html_module_2.location),
|
||||
u'updated': datetime(2016, 01, 26, 9, 6, 17)
|
||||
u'updated': datetime(2016, 1, 26, 9, 6, 17)
|
||||
}
|
||||
],
|
||||
helpers.preprocess_collection(self.user, self.course, initial_collection)
|
||||
|
||||
@@ -48,7 +48,7 @@ def handle_dashboard_error(view):
|
||||
"""
|
||||
try:
|
||||
return view(request, course_id=course_id)
|
||||
except DashboardError, error:
|
||||
except DashboardError as error:
|
||||
return error.response()
|
||||
|
||||
return wrapper
|
||||
|
||||
@@ -33,13 +33,13 @@ class TestAppVersionUpgradeMiddleware(CacheIsolationTestCase):
|
||||
AppVersionConfig(
|
||||
platform="iOS",
|
||||
version="2.2.2",
|
||||
expire_at=datetime(2014, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(2014, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(
|
||||
platform="iOS",
|
||||
version="4.4.4",
|
||||
expire_at=datetime(9000, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(9000, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(platform="iOS", version="6.6.6", expire_at=None, enabled=True).save()
|
||||
@@ -48,13 +48,13 @@ class TestAppVersionUpgradeMiddleware(CacheIsolationTestCase):
|
||||
AppVersionConfig(
|
||||
platform="Android",
|
||||
version="2.2.2",
|
||||
expire_at=datetime(2014, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(2014, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(
|
||||
platform="Android",
|
||||
version="4.4.4",
|
||||
expire_at=datetime(5000, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(5000, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(platform="Android", version="8.8.8", expire_at=None, enabled=True).save()
|
||||
|
||||
@@ -22,19 +22,19 @@ class TestAppVersionConfigModel(TestCase):
|
||||
AppVersionConfig(
|
||||
platform="ios",
|
||||
version="2.2.2",
|
||||
expire_at=datetime(2014, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(2014, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(
|
||||
platform="ios",
|
||||
version="4.1.1",
|
||||
expire_at=datetime(5000, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(5000, 1, 1, tzinfo=UTC),
|
||||
enabled=False
|
||||
).save()
|
||||
AppVersionConfig(
|
||||
platform="ios",
|
||||
version="4.4.4",
|
||||
expire_at=datetime(9000, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(9000, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(platform="ios", version="6.6.6", expire_at=None, enabled=True).save()
|
||||
@@ -44,13 +44,13 @@ class TestAppVersionConfigModel(TestCase):
|
||||
AppVersionConfig(
|
||||
platform="android",
|
||||
version="2.2.2",
|
||||
expire_at=datetime(2014, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(2014, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(
|
||||
platform="android",
|
||||
version="4.4.4",
|
||||
expire_at=datetime(9000, 01, 01, tzinfo=UTC),
|
||||
expire_at=datetime(9000, 1, 1, tzinfo=UTC),
|
||||
enabled=True
|
||||
).save()
|
||||
AppVersionConfig(platform="android", version="8.8.8", expire_at=None, enabled=True).save()
|
||||
|
||||
@@ -180,7 +180,7 @@ class PDFInvoice(object):
|
||||
"""
|
||||
try:
|
||||
img = Image.open(img_path)
|
||||
except IOError, ex:
|
||||
except IOError as ex:
|
||||
log.exception(u'Pdf unable to open the image file: %s', str(ex))
|
||||
img = None
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import copy
|
||||
from unittest import skip
|
||||
from mock import Mock, patch
|
||||
|
||||
from six import text_type
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import SESSION_KEY
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
@@ -97,7 +99,7 @@ class SSLClientTest(ModuleStoreTestCase):
|
||||
self.assertIn('<form role="form" id="register-form" method="post"', response.content)
|
||||
try:
|
||||
ExternalAuthMap.objects.get(external_id=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to external auth map, exception was {0}'.format(str(ex)))
|
||||
|
||||
with self.assertRaises(User.DoesNotExist):
|
||||
@@ -116,7 +118,7 @@ class SSLClientTest(ModuleStoreTestCase):
|
||||
|
||||
try:
|
||||
ExternalAuthMap.objects.get(external_id=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to external auth map, exception was {0}'.format(str(ex)))
|
||||
|
||||
with self.assertRaises(User.DoesNotExist):
|
||||
@@ -135,11 +137,11 @@ class SSLClientTest(ModuleStoreTestCase):
|
||||
# Assert our user exists in both eamap and Users, and that we are logged in
|
||||
try:
|
||||
ExternalAuthMap.objects.get(external_id=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to external auth map, exception was {0}'.format(str(ex)))
|
||||
try:
|
||||
User.objects.get(email=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to internal users, exception was {0}'.format(str(ex)))
|
||||
|
||||
@skip_unless_cms
|
||||
@@ -161,11 +163,11 @@ class SSLClientTest(ModuleStoreTestCase):
|
||||
# Assert our user exists in both eamap and Users, and that we are logged in
|
||||
try:
|
||||
ExternalAuthMap.objects.get(external_id=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to external auth map, exception was {0}'.format(str(ex)))
|
||||
try:
|
||||
User.objects.get(email=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to internal users, exception was {0}'.format(str(ex)))
|
||||
|
||||
@skip_unless_lms
|
||||
@@ -322,11 +324,11 @@ class SSLClientTest(ModuleStoreTestCase):
|
||||
# Assert our user exists in both eamap and Users
|
||||
try:
|
||||
ExternalAuthMap.objects.get(external_id=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to external auth map, exception was {0}'.format(str(ex)))
|
||||
try:
|
||||
User.objects.get(email=self.USER_EMAIL)
|
||||
except ExternalAuthMap.DoesNotExist, ex:
|
||||
except ExternalAuthMap.DoesNotExist as ex:
|
||||
self.fail(u'User did not get properly added to internal users, exception was {0}'.format(str(ex)))
|
||||
self.assertEqual(1, len(ExternalAuthMap.objects.all()))
|
||||
|
||||
@@ -382,7 +384,7 @@ class SSLClientTest(ModuleStoreTestCase):
|
||||
CourseEnrollment.enroll(user, course.id)
|
||||
|
||||
CourseStaffRole(course.id).add_users(user)
|
||||
course_private_url = reverse('course_handler', args=(unicode(course.id),))
|
||||
course_private_url = reverse('course_handler', args=(text_type(course.id),))
|
||||
self.assertNotIn(SESSION_KEY, self.client.session)
|
||||
|
||||
response = self.client.get(
|
||||
|
||||
@@ -28,8 +28,8 @@ from ..views import LOG_MESSAGE_CREATE, LOG_MESSAGE_DELETE
|
||||
from .helpers import make_image_file
|
||||
|
||||
TEST_PASSWORD = "test"
|
||||
TEST_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC)
|
||||
TEST_UPLOAD_DT2 = datetime.datetime(2003, 1, 9, 15, 43, 01, tzinfo=UTC)
|
||||
TEST_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 1, tzinfo=UTC)
|
||||
TEST_UPLOAD_DT2 = datetime.datetime(2003, 1, 9, 15, 43, 1, tzinfo=UTC)
|
||||
|
||||
|
||||
class ProfileImageEndpointMixin(UserSettingsEventTestMixin):
|
||||
|
||||
@@ -13,7 +13,7 @@ from student.tests.factories import UserFactory
|
||||
from ..image_helpers import get_profile_image_urls_for_user
|
||||
|
||||
TEST_SIZES = {'full': 50, 'small': 10}
|
||||
TEST_PROFILE_IMAGE_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC)
|
||||
TEST_PROFILE_IMAGE_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 1, tzinfo=UTC)
|
||||
|
||||
|
||||
@patch.dict('django.conf.settings.PROFILE_IMAGE_SIZES_MAP', TEST_SIZES, clear=True)
|
||||
|
||||
@@ -150,7 +150,7 @@ def node_prereqs_installation():
|
||||
# the forked process has returned
|
||||
proc = subprocess.Popen(npm_command, stderr=npm_log_file)
|
||||
proc.wait()
|
||||
except BuildFailure, error_text:
|
||||
except BuildFailure as error_text:
|
||||
if cb_error_text in error_text:
|
||||
print("npm install error detected. Retrying...")
|
||||
proc = subprocess.Popen(npm_command, stderr=npm_log_file)
|
||||
|
||||
@@ -893,7 +893,7 @@ def run_diff_quality(
|
||||
)
|
||||
)
|
||||
return True
|
||||
except BuildFailure, error_message:
|
||||
except BuildFailure as error_message:
|
||||
if is_percentage_failure(error_message):
|
||||
return False
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user