-
Notifications
You must be signed in to change notification settings - Fork 253
build: add python 3.11 and 3.12 ci checks #4153
build: add python 3.11 and 3.12 ci checks #4153
Conversation
@feanil Hi. Can you run the workflows on this PR, please? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Danyal-Faheem, firstly, I would like to ask to fix the automatic tests and secondly, these changes are not doing what is supposed to do since this is triggering 3 different actions but all of them are running with python 3.8 indeed the 3.12 test shouldn't pass since that depends on #4147
Hi @andrey-canon. Thank you for pointing out the problem. The Dockerfile is currently forcing python3.8 in the containers. I'll update the PR to allow different python versions to be installed. |
5955824
to
7caffb5
Compare
@Danyal-Faheem do we have an update on this PR? It looks like once we get it working, we'll need to backport this to Redwood as well. |
Hi @feanil, we're still working on this PR. It needs some changes in the Dockerfile as well. We will try to get it done as soon as possible so that we can backport it to redwood. |
7caffb5
to
0190f4d
Compare
@Danyal-Faheem and I have tested the changes, there's still some python tests failing under |
3f976dd
to
ce381be
Compare
pin django-oscar to 3.2, removed migrations, replace depreciated assertDictContainsSubset method with python code
ce381be
to
323c407
Compare
Hi @feanil, this PR is ready for review. Can you take a look? Thanks. |
pylintrc_backup
Outdated
@@ -0,0 +1,294 @@ | |||
[MASTER] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this file wont be needed.
requirements/base.in
Outdated
@@ -31,6 +31,7 @@ edx-django-utils | |||
edx-drf-extensions>=8.13.0 # 8.13 fixes forgiven JWTs for ecommerce | |||
edx-django-sites-extensions | |||
edx-ecommerce-worker | |||
edx-lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than base, this should be in test.in as this is only needed during testing.
ecommerce/credit/tests/test_views.py
Outdated
@@ -130,7 +130,18 @@ def _assert_success_checkout_page(self, sku=None): | |||
|
|||
response = self.client.get(self.path) | |||
self.assertEqual(response.status_code, 200) | |||
self.assertDictContainsSubset({'course': self.course}, response.context) | |||
if sys.version_info > (3, 9): | |||
context = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment here to explain why this is needed would be helpful. Plus, see if this can be improved. There are a bit too many if-elses in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding a comment for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also look for the alternative for the if-else.
requirements/dev.in
Outdated
@@ -2,7 +2,7 @@ | |||
-r docs.txt | |||
|
|||
django-debug-toolbar | |||
|
|||
needle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not longer needed, It was added to resolve conlicts. removing it.
requirements/dev.in
Outdated
@@ -12,3 +12,5 @@ ptvsd | |||
|
|||
# For devserver code reloading | |||
pywatchman | |||
astroid==3.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is astroid needed here? Furthermore, since the version has been constrained in constraints.txt, it wont be needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
astroid had a conflict with pylint version. So, it needs to be pinned.
I'll remove it from dev.in as it is in contraints.txt.
requirements/dev.in
Outdated
@@ -12,3 +12,5 @@ ptvsd | |||
|
|||
# For devserver code reloading | |||
pywatchman | |||
astroid==3.2.2 | |||
edx-lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it won't be required here. Once it is added to test.in, it should start appearing in dev.txt
Hello @andrey-canon, |
Hi @Faraz32123, sure, no problem, however I cannot do that this week, so I will review this next one : D |
Hello @feanil and @andrey-canon, I hope you guys are doing well, a reminder for you guys to review this PR for this issue to be closed. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes look good to me. I just left a suggestion related to the test changes because, personally, I don't see the point of implementing two different ways for different Python versions when one of them is compatible with both (I think I didn't test that). If so could you please apply that to all the tests modifications
ecommerce/credit/tests/test_views.py
Outdated
@@ -130,7 +130,21 @@ def _assert_success_checkout_page(self, sku=None): | |||
|
|||
response = self.client.get(self.path) | |||
self.assertEqual(response.status_code, 200) | |||
self.assertDictContainsSubset({'course': self.course}, response.context) | |||
if sys.version_info > (3, 9): | |||
# assertDictContainsSubset is depreciated in python version>3.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# assertDictContainsSubset is depreciated in python version>3.9 | |
# assertDictContainsSubset is deprecated in Python version > 3.9 |
???
ecommerce/credit/tests/test_views.py
Outdated
self.assertDictContainsSubset({'course': self.course}, response.context) | ||
if sys.version_info > (3, 9): | ||
# assertDictContainsSubset is depreciated in python version>3.9 | ||
# context.response return ContextList object, belwo statements will convert it to dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# context.response return ContextList object, belwo statements will convert it to dict | |
# response.context returns a ContextList object; the below statements will convert it to a dict |
??
ecommerce/credit/tests/test_views.py
Outdated
if sys.version_info > (3, 9): | ||
# assertDictContainsSubset is depreciated in python version>3.9 | ||
# context.response return ContextList object, belwo statements will convert it to dict | ||
# assertLessEqual method is used instead of depreciated assertDictContainsSubset method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# assertLessEqual method is used instead of depreciated assertDictContainsSubset method | |
# assertLessEqual method is used instead of the deprecated assertDictContainsSubset method |
ecommerce/core/tests/test_models.py
Outdated
if sys.version_info > (3, 9): | ||
self.assertLessEqual(expected.items(), last_request.headers.items()) | ||
else: | ||
self.assertDictContainsSubset(expected, last_request.headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if sys.version_info > (3, 9): | |
self.assertLessEqual(expected.items(), last_request.headers.items()) | |
else: | |
self.assertDictContainsSubset(expected, last_request.headers) | |
self.assertLessEqual(expected.items(), last_request.headers.items()) |
@@ -122,7 +123,10 @@ def test_post_enterprise_customer_user(self, mock_helpers, expected_return): | |||
self.learner.username | |||
) | |||
|
|||
self.assertDictContainsSubset(expected_return, response) | |||
if sys.version_info > (3, 9): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
Hello @andrey-canon, thanks for the review. I have updated the code according to the requested changes. Can u look into it again so that we can finalize it. |
ecommerce/core/tests/test_models.py
Outdated
@@ -1,6 +1,7 @@ | |||
|
|||
|
|||
import json | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this from all the files
5035417
to
9360ac0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for applying all the suggested changes
CC @feanil LGTM
⛔️ MAIN BRANCH WARNING! 2U EMPLOYEES must make branches against the 2u/main BRANCH
⛔️ DEPRECATION WARNING
Anyone internally merging to this repository is expected to release and monitor their changes; if you are not able to do this DO NOT MERGE, please coordinate with someone who can to ensure that the changes are released.
Required Testing
(^ We can remove that manual check once REV-2624 is done and the corresponding e2e test runs again)
Description
docker-compose
todocker compose
.PYTHON_ENV
andPYTHON_VERSION
variables to utilize the matrix values to test against multiple python versions.tox.ini
fle to includepy311
andpy312
as well.