Browse Source

feat: switch to Django 1.10 (#16109)

josh 5 years ago
parent
commit
c1c9d67ef5

+ 1 - 35
.travis.yml

@@ -34,7 +34,7 @@ env:
     - SENTRY_SKIP_BACKEND_VALIDATION=1
     - MIGRATIONS_TEST_MIGRATE=0
     # Use this to override the django version in the requirements file.
-    - DJANGO_VERSION=">=1.9,<1.10"
+    - DJANGO_VERSION=">=1.10,<1.11"
     # node's version is pinned by .nvmrc and is autodetected by `nvm install`.
     - NODE_DIR="${HOME}/.nvm/versions/node/v$(< .nvmrc)"
     - NODE_OPTIONS=--max-old-space-size=4096
@@ -149,18 +149,6 @@ matrix:
       name: 'Acceptance'
       env: TEST_SUITE=acceptance USE_SNUBA=1
 
-    - <<: *postgres_default
-      name: '[Django 1.10] Backend with migrations [Postgres] (1/2)'
-      env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=0 MIGRATIONS_TEST_MIGRATE=1
-
-    - <<: *postgres_default
-      name: '[Django 1.10] Backend with migrations [Postgres] (2/2)'
-      env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=postgres DB=postgres TOTAL_TEST_GROUPS=2 TEST_GROUP=1 MIGRATIONS_TEST_MIGRATE=1
-
-    - <<: *acceptance_default
-      name: '[Django 1.10] Acceptance'
-      env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=acceptance USE_SNUBA=1 PERCY_ENABLE=0
-
     - <<: *acceptance_default
       name: 'Plugins'
       env: TEST_SUITE=plugins DB=postgres PERCY_TOKEN=${PLUGIN_PERCY_TOKEN}
@@ -226,28 +214,6 @@ matrix:
       before_script:
         - psql -c 'create database sentry;' -U postgres
 
-    - python: 2.7
-      name: '[Django 1.10] Snuba Integration with migrations'
-      env: DJANGO_VERSION=">=1.10,<1.11" TEST_SUITE=snuba USE_SNUBA=1 SENTRY_ZOOKEEPER_HOSTS=localhost:2181 SENTRY_KAFKA_HOSTS=localhost:9092 MIGRATIONS_TEST_MIGRATE=1
-      services:
-        - docker
-        - memcached
-        - redis-server
-        - postgresql
-      before_install:
-        - *pip_install
-        - docker run -d --network host --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:4.1.0
-        - docker run -d --network host --name kafka -e KAFKA_ZOOKEEPER_CONNECT=localhost:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:4.1.0
-        - docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:19.11
-        - docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
-        - docker ps -a
-      install:
-        - python setup.py install_egg_info
-        - pip install -U -e ".[dev]"
-        - pip install confluent-kafka
-      before_script:
-        - psql -c 'create database sentry;' -U postgres
-
     # Deploy 'storybook' (component & style guide) - allowed to fail
     - name: 'Storybook Deploy'
       language: node_js

+ 1 - 1
requirements-base.txt

@@ -12,7 +12,7 @@ datadog>=0.15.0,<0.31.0
 django-crispy-forms==1.6.1
 django-picklefield>=0.3.0,<1.1.0
 django-sudo>=3.0.0,<4.0.0
-Django>=1.9,<1.10
+Django>=1.10,<1.11
 djangorestframework==3.4.7
 email-reply-parser>=0.2.0,<0.3.0
 enum34>=1.1.6,<1.2.0

+ 5 - 0
src/sentry/runner/settings.py

@@ -94,6 +94,11 @@ def configure(ctx, py, yaml, skip_service_validation=False):
 
     warnings.filterwarnings("default", "", Warning, r"^sentry")
 
+    # for now, squelch Django 2 warnings so prod logs aren't clogged
+    from django.utils.deprecation import RemovedInDjango20Warning
+
+    warnings.filterwarnings(action="ignore", category=RemovedInDjango20Warning)
+
     # Add in additional mimetypes that are useful for our static files
     # which aren't common in default system registries
     import mimetypes

+ 6 - 9
tests/sentry/api/endpoints/test_organization_searches.py

@@ -1,6 +1,5 @@
 from __future__ import absolute_import
 
-import django
 from django.utils import timezone
 from exam import fixture
 
@@ -24,10 +23,9 @@ class OrganizationSearchesListTest(APITestCase):
         project1 = self.create_project(teams=[team], name="foo")
         project2 = self.create_project(teams=[team], name="bar")
 
-        if django.VERSION[:2] >= (1, 8):
-            # Depending on test we run migrations in Django 1.8. This causes
-            # extra rows to be created, so remove them to keep this test working
-            SavedSearch.objects.filter(is_global=True).delete()
+        # Depending on test we run migrations in Django 1.8. This causes
+        # extra rows to be created, so remove them to keep this test working
+        SavedSearch.objects.filter(is_global=True).delete()
 
         SavedSearch.objects.create(
             project=project1, name="bar", query=DEFAULT_SAVED_SEARCHES[0]["query"]
@@ -71,10 +69,9 @@ class OrgLevelOrganizationSearchesListTest(APITestCase):
         return super(OrgLevelOrganizationSearchesListTest, self).get_response(*args, **params)
 
     def create_base_data(self):
-        if django.VERSION[:2] >= (1, 8):
-            # Depending on test we run migrations in Django 1.8. This causes
-            # extra rows to be created, so remove them to keep this test working
-            SavedSearch.objects.filter(is_global=True).delete()
+        # Depending on test we run migrations in Django 1.8. This causes
+        # extra rows to be created, so remove them to keep this test working
+        SavedSearch.objects.filter(is_global=True).delete()
 
         team = self.create_team(members=[self.user])
         SavedSearch.objects.create(

+ 0 - 4
tests/sentry/api/endpoints/test_project_details.py

@@ -3,7 +3,6 @@ from __future__ import absolute_import
 import mock
 import six
 
-import django
 from django.core.urlresolvers import reverse
 
 from sentry.constants import RESERVED_PROJECT_SLUGS
@@ -82,9 +81,6 @@ class ProjectDetailsTest(APITestCase):
             "foobar",
         )
         redirect_path = "/api/0/projects/%s/%s/" % (project.organization.slug, "foobar")
-        if django.VERSION < (1, 9):
-            # Django 1.9 no longer forcefully rewrites relative redirects to absolute URIs because of RFC 7231.
-            redirect_path = "http://testserver" + redirect_path
         # XXX: AttributeError: 'Response' object has no attribute 'url'
         # (this is with self.assertRedirects(response, ...))
         assert response["Location"] == redirect_path