Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Requirements Update #125

Merged
merged 2 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -68,15 +68,15 @@ 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
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
Expand Down
4 changes: 2 additions & 2 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 8 additions & 5 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)))

Expand Down
6 changes: 0 additions & 6 deletions tests/test_models_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)