diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 08a27a0619..21663faf40 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -3550,7 +3550,7 @@ class TestInstructorSendEmail(SiteMixin, SharedModuleStoreTestCase, LoginEnrollm self.full_test_message['schedule'] = "Blub Glub" self.full_test_message['browser_timezone'] = "America/New_York" expected_messages = [ - "Error occurred while attempting to create a scheduled bulk email task: unknown string format", + "Error occurred while attempting to create a scheduled bulk email task: Unknown string format: Blub Glub", ] url = reverse('send_email', kwargs={'course_id': str(self.course.id)}) diff --git a/openedx/core/djangoapps/content/block_structure/block_structure.py b/openedx/core/djangoapps/content/block_structure/block_structure.py index a8d10c4d81..f51f2ce599 100644 --- a/openedx/core/djangoapps/content/block_structure/block_structure.py +++ b/openedx/core/djangoapps/content/block_structure/block_structure.py @@ -11,9 +11,12 @@ The following internal data structures are implemented: from copy import deepcopy +from datetime import datetime from functools import partial from logging import getLogger +from dateutil.tz import tzlocal + from openedx.core.lib.graph_traversals import traverse_post_order, traverse_topologically from .exceptions import TransformerException @@ -464,7 +467,20 @@ class BlockStructureBlockData(BlockStructure): not found. """ block_data = self._block_data_map.get(usage_key) - return getattr(block_data, field_name, default) if block_data else default + xblock_field = getattr(block_data, field_name, default) if block_data else default + + if isinstance(xblock_field, datetime): + # Creating a new datetime object to avoid issues occuring due to upgrading + # python-datetuil version from 2.4.0 + # + # More info: https://openedx.atlassian.net/browse/BOM-2245 + if isinstance(xblock_field.tzinfo, tzlocal) and not hasattr(xblock_field.tzinfo, '_hasdst'): + return datetime( + year=xblock_field.year, month=xblock_field.month, day=xblock_field.day, + hour=xblock_field.hour, minute=xblock_field.minute, second=xblock_field.second, + tzinfo=tzlocal() + ) + return xblock_field def override_xblock_field(self, usage_key, field_name, override_data): """ diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 3af7d27891..747428c389 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -27,23 +27,14 @@ django-storages<1.9 # for them. edx-enterprise==3.49.5 -# Newer versions need a more recent version of python-dateutil -freezegun==0.3.12 - # oauthlib>3.0.1 causes test failures ( also remove the django-oauth-toolkit constraint when this is fixed ) oauthlib==3.0.1 # django-auth-toolkit==1.3.3 requires oauthlib>=3.1.0 which is pinned because of test failures django-oauth-toolkit<=1.3.2 -# Upgrading to 2.5.3 on 2020-01-03 triggered "'tzlocal' object has no attribute '_std_offset'" errors in production -python-dateutil==2.4.0 -# matplotlib>=3.4.0 requires python-dateutil>=2.7 +# Will be updated once we update python-dateutil package matplotlib<3.4.0 -# pandas>0.22.0 requires python-dateutil>=2.5.0 -pandas==0.22.0 -# networkx>=2.6 requires pandas>=1.1 -networkx<2.6 # tests failing for pymongo==3.11 pymongo<3.11 diff --git a/requirements/edx-sandbox/py38.txt b/requirements/edx-sandbox/py38.txt index 8fde6fc3ff..992361363c 100644 --- a/requirements/edx-sandbox/py38.txt +++ b/requirements/edx-sandbox/py38.txt @@ -18,8 +18,6 @@ cryptography==37.0.2 # via -r requirements/edx-sandbox/py38.in cycler==0.11.0 # via matplotlib -decorator==4.4.2 - # via networkx joblib==1.1.0 # via nltk kiwisolver==1.4.2 @@ -38,10 +36,8 @@ matplotlib==3.3.4 # -r requirements/edx-sandbox/py38.in mpmath==1.2.1 # via sympy -networkx==2.5.1 - # via - # -c requirements/edx-sandbox/../constraints.txt - # -r requirements/edx-sandbox/py38.in +networkx==2.8 + # via -r requirements/edx-sandbox/py38.in nltk==3.7 # via # -r requirements/edx-sandbox/py38.in @@ -65,10 +61,8 @@ pyparsing==3.0.9 # chem # matplotlib # openedx-calc -python-dateutil==2.4.0 - # via - # -c requirements/edx-sandbox/../constraints.txt - # matplotlib +python-dateutil==2.8.2 + # via matplotlib random2==1.0.1 # via -r requirements/edx-sandbox/py38.in regex==2022.4.24 diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index c86e5eb722..f7692f5efa 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -834,9 +834,8 @@ pysrt==1.1.2 # via # -r requirements/edx/base.in # edxval -python-dateutil==2.4.0 +python-dateutil==2.8.2 # via - # -c requirements/edx/../constraints.txt # -r requirements/edx/base.in # analytics-python # botocore diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index d8f9de315a..a417d513c4 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -698,10 +698,8 @@ filelock==3.7.0 # -r requirements/edx/testing.txt # tox # virtualenv -freezegun==0.3.12 - # via - # -c requirements/edx/../constraints.txt - # -r requirements/edx/testing.txt +freezegun==1.2.1 + # via -r requirements/edx/testing.txt frozenlist==1.3.0 # via # -r requirements/edx/testing.txt @@ -1176,9 +1174,8 @@ pytest-randomly==3.12.0 # via -r requirements/edx/testing.txt pytest-xdist[psutil]==2.5.0 # via -r requirements/edx/testing.txt -python-dateutil==2.4.0 +python-dateutil==2.8.2 # via - # -c requirements/edx/../constraints.txt # -r requirements/edx/testing.txt # analytics-python # botocore @@ -1345,7 +1342,6 @@ six==1.16.0 # edx-rbac # edx-sphinx-theme # event-tracking - # freezegun # fs # fs-s3fs # html5lib diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 390da4feb0..747a9ac678 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -673,10 +673,8 @@ filelock==3.7.0 # via # tox # virtualenv -freezegun==0.3.12 - # via - # -c requirements/edx/../constraints.txt - # -r requirements/edx/testing.in +freezegun==1.2.1 + # via -r requirements/edx/testing.in frozenlist==1.3.0 # via # -r requirements/edx/base.txt @@ -1107,9 +1105,8 @@ pytest-randomly==3.12.0 # via -r requirements/edx/testing.in pytest-xdist[psutil]==2.5.0 # via -r requirements/edx/testing.in -python-dateutil==2.4.0 +python-dateutil==2.8.2 # via - # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt # analytics-python # botocore @@ -1271,7 +1268,6 @@ six==1.16.0 # edx-milestones # edx-rbac # event-tracking - # freezegun # fs # fs-s3fs # html5lib