-
Notifications
You must be signed in to change notification settings - Fork 4
Update Django to 4.2 and Python to 3.9 #1
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
Open
stripathi669
wants to merge
1
commit into
master
Choose a base branch
from
update-django-python
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Defaulting to user installation because normal site-packages is not writeable | ||
Requirement already satisfied: packaging in /home/jules/.local/lib/python3.10/site-packages (16.8) | ||
Requirement already satisfied: pyparsing in /home/jules/.local/lib/python3.10/site-packages (from packaging) (2.2.0) | ||
Requirement already satisfied: six in /home/jules/.local/lib/python3.10/site-packages (from packaging) (1.10.0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# This will make sure the app is always imported when | ||
# Django starts so that shared_task will use this app. | ||
from ._celery import app as celery_app | ||
|
||
__all__ = ('celery_app',) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from celery import shared_task | ||
|
||
@shared_task | ||
def add(x, y): | ||
return x + y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from django.test import TestCase, Client | ||
from django.urls import reverse | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove test file |
||
|
||
class AdminViewTests(TestCase): | ||
def test_admin_login_page_loads(self): | ||
""" | ||
Test that the admin login page loads correctly. | ||
It might return 200 if already somehow authenticated by default test client setup, | ||
or 302 if it redirects to a login page. | ||
""" | ||
client = Client() | ||
# Try fetching the admin login URL. | ||
# If LOGIN_URL is customized, this might need adjustment, | ||
# but /admin/login/ is common, or /admin/ will redirect to it. | ||
try: | ||
admin_url = reverse('admin:index') | ||
except Exception: | ||
# Fallback if 'admin:index' is not found (e.g. admin not fully set up for URL reversing) | ||
admin_url = '/admin/' | ||
|
||
response = client.get(admin_url) | ||
self.assertIn( | ||
response.status_code, | ||
[200, 302], | ||
f"Admin page ({admin_url}) returned {response.status_code}, expected 200 or 302." | ||
) | ||
|
||
class CeleryTaskTests(TestCase): | ||
def test_add_task_importable_and_callable(self): | ||
""" | ||
Test that the sample 'add' task can be imported and is callable. | ||
""" | ||
try: | ||
from .tasks import add | ||
self.assertTrue(callable(add), "Add task 'add' should be callable.") | ||
except ImportError: | ||
self.fail("Could not import task 'add' from ebdjango.tasks.") | ||
except Exception as e: | ||
self.fail(f"An unexpected error occurred during task import/check: {e}") | ||
|
||
def test_add_task_basic_execution(self): | ||
""" | ||
A very basic test of the add task's execution logic. | ||
Note: This runs the task synchronously in the test process, not via a Celery worker. | ||
""" | ||
try: | ||
from .tasks import add | ||
result = add.delay(3, 5) # Using .delay() to simulate Celery call style | ||
# For testing purposes with CELERY_TASK_ALWAYS_EAGER=True (often set for tests), | ||
# .delay() might execute synchronously and return an EagerResult. | ||
# If not eager, this would return an AsyncResult. | ||
# We'll check if the result has a 'get' method to fetch the actual return value. | ||
if hasattr(result, 'get'): | ||
# Timeout for safety, though eager tasks should be immediate. | ||
self.assertEqual(result.get(timeout=10), 8, "Task 'add(3, 5)' should return 8.") | ||
else: | ||
# Fallback for when task isn't eager and we just have an AsyncResult | ||
# This part of the test would be more complex in a real scenario | ||
# requiring worker setup or mocking. For now, we just check it didn't fail. | ||
self.assertIsNotNone(result.id, "Task 'add' should return an AsyncResult with an ID.") | ||
|
||
except ImportError: | ||
self.fail("Could not import task 'add' from ebdjango.tasks.") | ||
except Exception as e: | ||
self.fail(f"An unexpected error occurred during task execution test: {e}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
amqp==1.4.9 | ||
anyjson==0.3.3 | ||
amqp>=5.1.1,<6.0.0 # Updated for Celery | ||
appdirs==1.4.3 | ||
awsebcli==3.10.1 | ||
awsebcli==3.10.1 # Reverted to original | ||
backports.ssl-match-hostname==3.5.0.1 | ||
billiard==3.3.0.23 | ||
billiard>=4.2.0,<5.0 # Updated for Celery | ||
blessed==1.14.2 | ||
botocore==1.5.39 | ||
celery==3.1.25 | ||
botocore==1.5.39 # Reverted to original | ||
celery[django]>=5.3,<5.4 # Updated as per task | ||
cement==2.8.2 | ||
colorama==0.3.7 | ||
Django==1.11 | ||
-e git+https://github.com/celery/django-celery@5910af77382b249b2ba9b2fe7d3f7f57151ffe74#egg=django_celery | ||
Django>=4.2,<4.3 # Updated as per task | ||
docker-py==1.7.2 | ||
dockerpty==0.4.1 | ||
docopt==0.6.2 | ||
docutils==0.13.1 | ||
jmespath==0.9.2 | ||
kombu==3.0.37 | ||
packaging==16.8 | ||
kombu>=5.3.0,<6.0 # Updated for Celery | ||
packaging==16.8 # Reverted to original | ||
pathspec==0.5.0 | ||
psycopg2==2.7.1 | ||
pyparsing==2.2.0 | ||
python-dateutil==2.6.0 | ||
pytz==2017.2 | ||
PyYAML==3.12 | ||
requests==2.9.1 | ||
psycopg2-binary<3.0 # Updated psycopg2 to binary | ||
pyparsing==2.2.0 # Reverted to original | ||
python-dateutil>=2.8.2,<3.0.0 # Updated for Celery/botocore | ||
pytz==2017.2 # Reverted to original | ||
PyYAML==3.12 # Reverted to original | ||
requests==2.9.1 # Reverted to original | ||
semantic-version==2.5.0 | ||
six==1.10.0 | ||
six==1.10.0 # Reverted to original | ||
tabulate==0.7.5 | ||
termcolor==1.1.0 | ||
wcwidth==0.1.7 | ||
websocket-client==0.40.0 | ||
# colorama==0.3.7 will be pulled by awsebcli==3.10.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python-3.9 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
don't change this