From 06313b8b5adb98f569954e098ee2f29fcbc94b61 Mon Sep 17 00:00:00 2001 From: edX requirements bot Date: Sun, 12 Dec 2021 22:25:09 -0500 Subject: [PATCH 1/2] chore: Updating Python Requirements --- requirements/base.txt | 10 +++++----- requirements/ci.txt | 4 ++-- requirements/dev.txt | 16 ++++++++-------- requirements/doc.txt | 14 +++++++------- requirements/pip.txt | 2 +- requirements/quality.txt | 16 ++++++++-------- requirements/test.txt | 10 +++++----- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index e912e27..57d0be2 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -12,11 +12,11 @@ certifi==2021.10.8 # via requests cffi==1.15.0 # via cryptography -charset-normalizer==2.0.8 +charset-normalizer==2.0.9 # via requests cryptography==36.0.0 # via pyjwt -django==3.2.9 +django==3.2.10 # via # -c requirements/common_constraints.txt # -r requirements/base.in @@ -56,7 +56,7 @@ future==0.18.2 # via pyjwkest idna==3.3 # via requests -lxml==4.6.4 +lxml==4.6.5 # via xblock markupsafe==2.0.1 # via xblock @@ -68,7 +68,7 @@ psutil==5.8.0 # via edx-django-utils pycparser==2.21 # via cffi -pycryptodomex==3.11.0 +pycryptodomex==3.12.0 # via pyjwkest pyjwkest==1.4.2 # via edx-drf-extensions @@ -76,7 +76,7 @@ pyjwt[crypto]==2.3.0 # via # drf-jwt # edx-drf-extensions -pymongo==3.12.1 +pymongo==4.0.1 # via edx-opaque-keys python-dateutil==2.8.2 # via diff --git a/requirements/ci.txt b/requirements/ci.txt index f1bdcb8..e8a226e 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -8,13 +8,13 @@ backports.entry-points-selectable==1.1.1 # via virtualenv certifi==2021.10.8 # via requests -charset-normalizer==2.0.8 +charset-normalizer==2.0.9 # via requests codecov==2.1.12 # via -r requirements/ci.in coverage==6.2 # via codecov -distlib==0.3.3 +distlib==0.3.4 # via virtualenv filelock==3.4.0 # via diff --git a/requirements/dev.txt b/requirements/dev.txt index eee3151..04abb1b 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -29,7 +29,7 @@ cffi==1.15.0 # via # -r requirements/quality.txt # cryptography -charset-normalizer==2.0.8 +charset-normalizer==2.0.9 # via # -r requirements/quality.txt # requests @@ -63,7 +63,7 @@ diff-cover==4.0.0 # via # -c requirements/constraints.txt # -r requirements/dev.in -django==3.2.9 +django==3.2.10 # via # -c requirements/common_constraints.txt # -r requirements/quality.txt @@ -144,7 +144,7 @@ lazy-object-proxy==1.6.0 # via # -r requirements/quality.txt # astroid -lxml==4.6.4 +lxml==4.6.5 # via # -r requirements/quality.txt # xblock @@ -206,7 +206,7 @@ pycparser==2.21 # via # -r requirements/quality.txt # cffi -pycryptodomex==3.11.0 +pycryptodomex==3.12.0 # via # -r requirements/quality.txt # pyjwkest @@ -223,7 +223,7 @@ pyjwt[crypto]==2.3.0 # -r requirements/quality.txt # drf-jwt # edx-drf-extensions -pylint==2.12.1 +pylint==2.12.2 # via # -r requirements/quality.txt # edx-lint @@ -243,7 +243,7 @@ pylint-plugin-utils==0.6 # -r requirements/quality.txt # pylint-celery # pylint-django -pymongo==3.12.1 +pymongo==4.0.1 # via # -r requirements/quality.txt # edx-opaque-keys @@ -258,7 +258,7 @@ pytest==6.2.5 # pytest-django pytest-cov==3.0.0 # via -r requirements/quality.txt -pytest-django==4.4.0 +pytest-django==4.5.2 # via -r requirements/quality.txt python-dateutil==2.8.2 # via @@ -327,7 +327,7 @@ tomli==1.2.2 # -r requirements/quality.txt # coverage # pep517 -typing-extensions==4.0.0 +typing-extensions==4.0.1 # via # -r requirements/quality.txt # astroid diff --git a/requirements/doc.txt b/requirements/doc.txt index 405aa57..a6ebc44 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -30,7 +30,7 @@ cffi==1.15.0 # via # -r requirements/test.txt # cryptography -charset-normalizer==2.0.8 +charset-normalizer==2.0.9 # via # -r requirements/test.txt # requests @@ -50,7 +50,7 @@ cryptography==36.0.0 # pyjwt ddt==1.4.4 # via -r requirements/test.txt -django==3.2.9 +django==3.2.10 # via # -c requirements/common_constraints.txt # -r requirements/test.txt @@ -123,7 +123,7 @@ jinja2==3.0.3 # -r requirements/test.txt # code-annotations # sphinx -lxml==4.6.4 +lxml==4.6.5 # via # -r requirements/test.txt # xblock @@ -164,7 +164,7 @@ pycparser==2.21 # via # -r requirements/test.txt # cffi -pycryptodomex==3.11.0 +pycryptodomex==3.12.0 # via # -r requirements/test.txt # pyjwkest @@ -182,7 +182,7 @@ pyjwt[crypto]==2.3.0 # -r requirements/test.txt # drf-jwt # edx-drf-extensions -pymongo==3.12.1 +pymongo==4.0.1 # via # -r requirements/test.txt # edx-opaque-keys @@ -197,7 +197,7 @@ pytest==6.2.5 # pytest-django pytest-cov==3.0.0 # via -r requirements/test.txt -pytest-django==4.4.0 +pytest-django==4.5.2 # via -r requirements/test.txt python-dateutil==2.8.2 # via @@ -220,7 +220,7 @@ pyyaml==6.0 # -r requirements/test.txt # code-annotations # xblock -readme-renderer==30.0 +readme-renderer==31.0 # via -r requirements/doc.in requests==2.26.0 # via diff --git a/requirements/pip.txt b/requirements/pip.txt index 6638848..76198dd 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -10,5 +10,5 @@ wheel==0.37.0 # The following packages are considered to be unsafe in a requirements file: pip==21.3.1 # via -r requirements/pip.in -setuptools==59.4.0 +setuptools==59.6.0 # via -r requirements/pip.in diff --git a/requirements/quality.txt b/requirements/quality.txt index 6f66cbc..244866e 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -28,7 +28,7 @@ cffi==1.15.0 # via # -r requirements/test.txt # cryptography -charset-normalizer==2.0.8 +charset-normalizer==2.0.9 # via # -r requirements/test.txt # requests @@ -54,7 +54,7 @@ cryptography==36.0.0 # pyjwt ddt==1.4.4 # via -r requirements/test.txt -django==3.2.9 +django==3.2.10 # via # -c requirements/common_constraints.txt # -r requirements/test.txt @@ -122,7 +122,7 @@ jinja2==3.0.3 # code-annotations lazy-object-proxy==1.6.0 # via astroid -lxml==4.6.4 +lxml==4.6.5 # via # -r requirements/test.txt # xblock @@ -167,7 +167,7 @@ pycparser==2.21 # via # -r requirements/test.txt # cffi -pycryptodomex==3.11.0 +pycryptodomex==3.12.0 # via # -r requirements/test.txt # pyjwkest @@ -182,7 +182,7 @@ pyjwt[crypto]==2.3.0 # -r requirements/test.txt # drf-jwt # edx-drf-extensions -pylint==2.12.1 +pylint==2.12.2 # via # edx-lint # pylint-celery @@ -196,7 +196,7 @@ pylint-plugin-utils==0.6 # via # pylint-celery # pylint-django -pymongo==3.12.1 +pymongo==4.0.1 # via # -r requirements/test.txt # edx-opaque-keys @@ -211,7 +211,7 @@ pytest==6.2.5 # pytest-django pytest-cov==3.0.0 # via -r requirements/test.txt -pytest-django==4.4.0 +pytest-django==4.5.2 # via -r requirements/test.txt python-dateutil==2.8.2 # via @@ -275,7 +275,7 @@ tomli==1.2.2 # via # -r requirements/test.txt # coverage -typing-extensions==4.0.0 +typing-extensions==4.0.1 # via # astroid # pylint diff --git a/requirements/test.txt b/requirements/test.txt index 59ab0b9..6193c52 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -22,7 +22,7 @@ cffi==1.15.0 # via # -r requirements/base.txt # cryptography -charset-normalizer==2.0.8 +charset-normalizer==2.0.9 # via # -r requirements/base.txt # requests @@ -93,7 +93,7 @@ iniconfig==1.1.1 # via pytest jinja2==3.0.3 # via code-annotations -lxml==4.6.4 +lxml==4.6.5 # via # -r requirements/base.txt # xblock @@ -126,7 +126,7 @@ pycparser==2.21 # via # -r requirements/base.txt # cffi -pycryptodomex==3.11.0 +pycryptodomex==3.12.0 # via # -r requirements/base.txt # pyjwkest @@ -139,7 +139,7 @@ pyjwt[crypto]==2.3.0 # -r requirements/base.txt # drf-jwt # edx-drf-extensions -pymongo==3.12.1 +pymongo==4.0.1 # via # -r requirements/base.txt # edx-opaque-keys @@ -151,7 +151,7 @@ pytest==6.2.5 # pytest-django pytest-cov==3.0.0 # via -r requirements/test.in -pytest-django==4.4.0 +pytest-django==4.5.2 # via -r requirements/test.in python-dateutil==2.8.2 # via From 25c31d40cf40165e301b6361955f25c6cdab917a Mon Sep 17 00:00:00 2001 From: Dillon Dumesnil Date: Tue, 14 Dec 2021 07:32:24 -0700 Subject: [PATCH 2/2] fix: Updates DummySchedule to fix broken tests Tests were failing due to receiving created and start_date in both positional and keyword args via the init method. I've opted to just remove the custom init method and just specify the created date when making a DummySchedule --- tests/test_api.py | 6 ++++-- tests/test_models.py | 13 ++++++++----- tests/test_models_app/models.py | 6 ------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index bb99aed..a6f6ef3 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -41,7 +41,9 @@ def setUp(self): self.enrollment = DummyEnrollment(user=self.user, course=self.course) self.enrollment.save() - self.schedule = DummySchedule(enrollment=self.enrollment, start_date=datetime(2019, 4, 1)) + self.schedule = DummySchedule( + enrollment=self.enrollment, created=datetime(2019, 4, 1), start_date=datetime(2019, 4, 1) + ) self.schedule.save() dummy_schedule_patcher = patch('edx_when.utils.Schedule', DummySchedule) @@ -177,7 +179,7 @@ def test_get_dates_for_course(self): enrollment2 = DummyEnrollment(user=self.user, course=course2) enrollment2.save() - schedule2 = DummySchedule(enrollment=enrollment2, start_date=datetime(2019, 4, 1)) + schedule2 = DummySchedule(enrollment=enrollment2, created=datetime(2019, 4, 1), start_date=datetime(2019, 4, 1)) schedule2.save() api.set_dates_for_course(new_items[0][0].course_key, new_items) diff --git a/tests/test_models.py b/tests/test_models.py index fd0ebec..fe6475a 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -25,9 +25,12 @@ class TestDatePolicy(TestCase): @ddt.data( (None, None, None, None), (datetime(2020, 1, 1), None, None, datetime(2020, 1, 1)), - (datetime(2020, 1, 1), None, DummySchedule(start_date=datetime(2020, 3, 1)), datetime(2020, 1, 1)), - (None, timedelta(days=1), DummySchedule(start_date=datetime(2020, 1, 1)), datetime(2020, 1, 2)), - (datetime(2020, 3, 1), timedelta(days=1), DummySchedule(start_date=datetime(2020, 1, 1)), datetime(2020, 1, 2)), + (datetime(2020, 1, 1), None, + DummySchedule(created=datetime(2020, 3, 1), start_date=datetime(2020, 3, 1)), datetime(2020, 1, 1)), + (None, timedelta(days=1), + DummySchedule(created=datetime(2020, 1, 1), start_date=datetime(2020, 1, 1)), datetime(2020, 1, 2)), + (datetime(2020, 3, 1), timedelta(days=1), + DummySchedule(created=datetime(2020, 1, 1), start_date=datetime(2020, 1, 1)), datetime(2020, 1, 2)), ) @ddt.unpack def test_actual_date(self, abs_date, rel_date, schedule, expected): @@ -47,14 +50,14 @@ def test_actual_date_failure(self, abs_date, rel_date, schedule): def test_actual_date_schedule_after_end(self): # This only applies for relative dates so we are not testing abs date. policy = DatePolicy(rel_date=timedelta(days=1)) - schedule = DummySchedule(start_date=datetime(2020, 4, 1)) + schedule = DummySchedule(created=datetime(2020, 4, 1), start_date=datetime(2020, 4, 1)) self.assertIsNone(policy.actual_date(schedule, end_datetime=datetime(2020, 1, 1))) def test_actual_date_schedule_after_cutoff(self): # This only applies for relative dates so we are not testing abs date. day = timedelta(days=1) policy = DatePolicy(rel_date=day) - schedule = DummySchedule(start_date=datetime(2020, 4, 1)) + schedule = DummySchedule(created=datetime(2020, 4, 1), start_date=datetime(2020, 4, 1)) self.assertIsNone(policy.actual_date(schedule, cutoff_datetime=(schedule.created - day))) self.assertIsNotNone(policy.actual_date(schedule, cutoff_datetime=(schedule.created + day))) diff --git a/tests/test_models_app/models.py b/tests/test_models_app/models.py index 599371e..fb31d8e 100644 --- a/tests/test_models_app/models.py +++ b/tests/test_models_app/models.py @@ -42,9 +42,3 @@ class DummySchedule(models.Model): db_index=True, help_text='Date this schedule went into effect' ) - - def __init__(self, *args, created=None, start_date=None, **kwargs): - # Ensure we have a created value, if possible - if not created and start_date: - created = start_date - super().__init__(*args, created=created, start_date=start_date, **kwargs)