Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Run test on Django 4.2 #4076

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .ci/docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "2"

services:
db:
image: mysql:5.7
image: mysql:8.0
container_name: db
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
environment:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
strategy:
matrix:
include:
- django-env: django32
- django-env: django42
testname: quality-and-jobs
targets: PYTHON_ENV=py38 requirements.js check_translations_up_to_date validate_translations clean_static static quality validate_js check_keywords
- django-env: django32
- django-env: django42
testname: test-python
targets: PYTHON_ENV=py38 requirements.js clean_static static validate_python
- django-env: django32
- django-env: django42
testname: acceptance-python
targets: PYTHON_ENV=py38 requirements.js clean_static static acceptance

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NODE_BIN=./node_modules/.bin
DIFF_COVER_BASE_BRANCH=master
PYTHON_ENV=py38
DJANGO_ENV_VAR=$(if $(DJANGO_ENV),$(DJANGO_ENV),django32)
DJANGO_ENV_VAR=$(if $(DJANGO_ENV),$(DJANGO_ENV),django42)

help:
@echo ''
Expand Down
2 changes: 1 addition & 1 deletion ecommerce/extensions/analytics/tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TrackingMiddlewareTests(TestCase):

def setUp(self):
super(TrackingMiddlewareTests, self).setUp()
self.middleware = middleware.TrackingMiddleware()
self.middleware = middleware.TrackingMiddleware(get_response=lambda request: None)
self.request_factory = RequestFactory()
self.user = self.create_user()

Expand Down
31 changes: 16 additions & 15 deletions ecommerce/extensions/catalogue/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,24 @@ def is_executive_education_2u_product(self):
]

def save(self, *args, **kwargs):
try:
if not isinstance(self.attr.note, str) and self.attr.note is not None:
if self.id:
try:
if not isinstance(self.attr.note, str) and self.attr.note is not None:
log_message_and_raise_validation_error(
'Failed to create Product. Product note value must be of type string'
)
except AttributeError:
pass

try:
if self.attr.notify_email is not None:
validate_email(self.attr.notify_email)
except ValidationError:
log_message_and_raise_validation_error(
'Failed to create Product. Product note value must be of type string'
'Notification email must be a valid email address.'
)
except AttributeError:
pass

try:
if self.attr.notify_email is not None:
validate_email(self.attr.notify_email)
except ValidationError:
log_message_and_raise_validation_error(
'Notification email must be a valid email address.'
)
except AttributeError:
pass
except AttributeError:
pass

super(Product, self).save(*args, **kwargs) # pylint: disable=bad-super-call

Expand Down
2 changes: 1 addition & 1 deletion ecommerce/extensions/payment/core/tests/test_sdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def test_sdn_is_down_sdn_fallback_called(
If there is no hit, allow purchase.
"""
request = RequestFactory().post('/payment/cybersource/submit/')
middleware = SessionMiddleware()
middleware = SessionMiddleware(get_response=lambda request: None)
middleware.process_request(request)
request.session.save()
site_configuration = self.site.siteconfiguration
Expand Down
1 change: 0 additions & 1 deletion ecommerce/extensions/refund/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'ecommerce.extensions.refund.apps.RefundConfig' # pragma: no cover
72 changes: 36 additions & 36 deletions ecommerce/settings/_oscar.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,48 @@

# APP CONFIGURATION
OSCAR_APPS = [
'oscar',
'oscar.apps.address',
'oscar.apps.shipping',
'oscar.apps.catalogue.reviews',
'oscar.apps.search',
'oscar.apps.wishlists',

'ecommerce.extensions',
'ecommerce.extensions.iap',
'ecommerce.extensions.api',
"oscar.config.Shop",
"oscar.apps.address.apps.AddressConfig",
'oscar.apps.shipping.apps.ShippingConfig',
'oscar.apps.catalogue.reviews.apps.CatalogueReviewsConfig',
"oscar.apps.search.apps.SearchConfig",
"oscar.apps.wishlists.apps.WishlistsConfig",

'ecommerce.extensions.config.EdxShop',
'ecommerce.extensions.iap.apps.IapConfig',
'ecommerce.extensions.api', # isn't an oscar app
'ecommerce.extensions.communication.apps.CommunicationConfig',
'ecommerce.extensions.fulfillment',
'ecommerce.extensions.refund',
'ecommerce.extensions.analytics',
'ecommerce.extensions.basket',
'ecommerce.extensions.catalogue',
'ecommerce.extensions.checkout',
'ecommerce.extensions.customer',
'ecommerce.extensions.offer',
'ecommerce.extensions.order',
'ecommerce.extensions.partner',
'ecommerce.extensions.payment',
'ecommerce.extensions.voucher',
'ecommerce.extensions.fulfillment', # isn't an oscar app
'ecommerce.extensions.refund.apps.RefundConfig',
'ecommerce.extensions.analytics.apps.AnalyticsConfig',
'ecommerce.extensions.basket.apps.BasketConfig',
'ecommerce.extensions.catalogue.apps.CatalogueConfig',
'ecommerce.extensions.checkout.apps.CheckoutConfig',
'ecommerce.extensions.customer.apps.CustomerConfig',
'ecommerce.extensions.offer.apps.OfferConfig',
'ecommerce.extensions.order.apps.OrderConfig',
'ecommerce.extensions.partner.apps.PartnerConfig',
'ecommerce.extensions.payment.apps.PaymentConfig',
'ecommerce.extensions.voucher.apps.VoucherConfig',

# Dashboard applications depend on models declared in the core applications (basket, catalogue, etc).
# To prevent issues with Oscar’s dynamic model loading, overrides of dashboard applications should
# follow overrides of core applications
'oscar.apps.dashboard.reports',
'oscar.apps.dashboard.partners',
'oscar.apps.dashboard.pages',
'oscar.apps.dashboard.ranges',
'oscar.apps.dashboard.reviews',
'oscar.apps.dashboard.vouchers',
'oscar.apps.dashboard.communications',
'oscar.apps.dashboard.shipping',

'ecommerce.extensions.dashboard',
'ecommerce.extensions.dashboard.catalogue',
'ecommerce.extensions.dashboard.offers',
"oscar.apps.dashboard.reports.apps.ReportsDashboardConfig",
"oscar.apps.dashboard.partners.apps.PartnersDashboardConfig",
"oscar.apps.dashboard.pages.apps.PagesDashboardConfig",
"oscar.apps.dashboard.ranges.apps.RangesDashboardConfig",
'oscar.apps.dashboard.reviews.apps.ReviewsDashboardConfig',
"oscar.apps.dashboard.vouchers.apps.VouchersDashboardConfig",
"oscar.apps.dashboard.communications.apps.CommunicationsDashboardConfig",
'oscar.apps.dashboard.shipping.apps.ShippingDashboardConfig',

'ecommerce.extensions.dashboard.apps.DashboardConfig',
'ecommerce.extensions.dashboard.catalogue.apps.CatalogueDashboardConfig',
'ecommerce.extensions.dashboard.offers.apps.OffersDashboardConfig',
'ecommerce.extensions.dashboard.refunds.apps.RefundsDashboardConfig', # Providing full path to make the signals work
'ecommerce.extensions.dashboard.orders',
'ecommerce.extensions.dashboard.users',
'ecommerce.extensions.dashboard.orders.apps.OrdersDashboardConfig',
'ecommerce.extensions.dashboard.users.apps.UsersDashboardConfig',

# 3rd-party apps that oscar depends on
'haystack',
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ django-oscar==3.2.2
# via
# -c requirements/constraints.txt
# -r requirements/base.in
django-phonenumber-field==5.0.0
django-phonenumber-field==5.1.0
# via django-oscar
django-simple-history==3.0.0
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ django-model-utils==4.3.1
# edx-rbac
django-oscar==3.2.2
# via -r requirements/test.txt
django-phonenumber-field==5.0.0
django-phonenumber-field==5.1.0
# via
# -r requirements/test.txt
# django-oscar
Expand Down
2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ django-oscar==3.2.2
# via
# -c requirements/constraints.txt
# -r requirements/base.in
django-phonenumber-field==5.0.0
django-phonenumber-field==5.1.0
# via django-oscar
django-ses==3.5.0
# via -r requirements/production.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ django-oscar==3.2.2
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
django-phonenumber-field==5.0.0
django-phonenumber-field==5.1.0
# via
# -r requirements/base.txt
# django-oscar
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tox]
skipsdist=True
envlist = py38-django32-{static,pylint,tests,theme_static,check_keywords},py38-{isort,pycodestyle,extract_translations,dummy_translations,compile_translations, detect_changed_translations,validate_translations},docs

envlist = py38-django42-{static,pylint,tests,theme_static,check_keywords},py38-{isort,pycodestyle,extract_translations,dummy_translations,compile_translations, detect_changed_translations,validate_translations},docs
[pytest]
addopts = --ds=ecommerce.settings.test --cov=ecommerce --cov-report term --cov-config=.coveragerc --no-cov-on-fail -p no:randomly --no-migrations -m "not acceptance"
testpaths = ecommerce
Expand Down Expand Up @@ -47,7 +46,7 @@ setenv =
SELENIUM_BROWSER=firefox
deps =
-r{toxinidir}/requirements/test.txt
django32: Django>=3.2,<3.3
django42: Django>=4.2,<4.3
allowlist_externals =
/bin/bash
changedir =
Expand Down
Loading