forked from GithubBackups/healthchecks
Dropping Python 2 support
This commit is contained in:
parent
9fb7ca7103
commit
9bc0f1b82a
@ -1,6 +1,5 @@
|
|||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
|
||||||
- "3.5"
|
- "3.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
install:
|
install:
|
||||||
|
@ -20,7 +20,7 @@ It is live here: [http://healthchecks.io/](http://healthchecks.io/)
|
|||||||
|
|
||||||
The building blocks are:
|
The building blocks are:
|
||||||
|
|
||||||
* Python 2 or Python 3
|
* Python 3
|
||||||
* Django 1.11
|
* Django 1.11
|
||||||
* PostgreSQL or MySQL
|
* PostgreSQL or MySQL
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ from hc.api.models import Channel, Check, Notification
|
|||||||
from hc.test import BaseTestCase
|
from hc.test import BaseTestCase
|
||||||
from mock import patch
|
from mock import patch
|
||||||
from requests.exceptions import ConnectionError, Timeout
|
from requests.exceptions import ConnectionError, Timeout
|
||||||
from six import binary_type
|
|
||||||
|
|
||||||
|
|
||||||
class NotifyTestCase(BaseTestCase):
|
class NotifyTestCase(BaseTestCase):
|
||||||
@ -143,7 +142,7 @@ class NotifyTestCase(BaseTestCase):
|
|||||||
args, kwargs = mock_request.call_args
|
args, kwargs = mock_request.call_args
|
||||||
|
|
||||||
# unicode should be encoded into utf-8
|
# unicode should be encoded into utf-8
|
||||||
self.assertTrue(isinstance(kwargs["data"], binary_type))
|
self.assertIsInstance(kwargs["data"], bytes)
|
||||||
|
|
||||||
@patch("hc.api.transports.requests.request")
|
@patch("hc.api.transports.requests.request")
|
||||||
def test_webhooks_handle_json_value(self, mock_request):
|
def test_webhooks_handle_json_value(self, mock_request):
|
||||||
|
@ -3,7 +3,7 @@ from django.template.loader import render_to_string
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
from six.moves.urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from hc.accounts.models import Profile
|
from hc.accounts.models import Profile
|
||||||
from hc.lib import emails
|
from hc.lib import emails
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from croniter import croniter
|
from croniter import croniter
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from six.moves.urllib_parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from pytz import all_timezones
|
from pytz import all_timezones
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from datetime import datetime, timedelta as td
|
from datetime import datetime, timedelta as td
|
||||||
import json
|
import json
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
from croniter import croniter
|
from croniter import croniter
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -14,7 +15,6 @@ from django.template.loader import render_to_string
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.six.moves.urllib.parse import urlencode
|
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
from hc.api.decorators import uuid_or_400
|
from hc.api.decorators import uuid_or_400
|
||||||
|
@ -5,7 +5,6 @@ Supports only a tiny subset of jsonschema.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from croniter import croniter
|
from croniter import croniter
|
||||||
from six import string_types
|
|
||||||
from pytz import all_timezones
|
from pytz import all_timezones
|
||||||
|
|
||||||
|
|
||||||
@ -15,7 +14,7 @@ class ValidationError(Exception):
|
|||||||
|
|
||||||
def validate(obj, schema, obj_name="value"):
|
def validate(obj, schema, obj_name="value"):
|
||||||
if schema.get("type") == "string":
|
if schema.get("type") == "string":
|
||||||
if not isinstance(obj, string_types):
|
if not isinstance(obj, str):
|
||||||
raise ValidationError("%s is not a string" % obj_name)
|
raise ValidationError("%s is not a string" % obj_name)
|
||||||
if "maxLength" in schema and len(obj) > schema["maxLength"]:
|
if "maxLength" in schema and len(obj) > schema["maxLength"]:
|
||||||
raise ValidationError("%s is too long" % obj_name)
|
raise ValidationError("%s is too long" % obj_name)
|
||||||
|
@ -4,7 +4,6 @@ from unittest import skipIf
|
|||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from hc.payments.models import Subscription
|
from hc.payments.models import Subscription
|
||||||
from hc.test import BaseTestCase
|
from hc.test import BaseTestCase
|
||||||
import six
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import reportlab
|
import reportlab
|
||||||
@ -37,8 +36,8 @@ class PdfInvoiceTestCase(BaseTestCase):
|
|||||||
|
|
||||||
self.client.login(username="alice@example.org", password="password")
|
self.client.login(username="alice@example.org", password="password")
|
||||||
r = self.client.get("/invoice/pdf/abc123/")
|
r = self.client.get("/invoice/pdf/abc123/")
|
||||||
self.assertTrue(six.b("ABC123") in r.content)
|
self.assertTrue(b"ABC123" in r.content)
|
||||||
self.assertTrue(six.b("alice@example.org") in r.content)
|
self.assertTrue(b"alice@example.org" in r.content)
|
||||||
|
|
||||||
@patch("hc.payments.models.braintree")
|
@patch("hc.payments.models.braintree")
|
||||||
def test_it_checks_customer_id(self, mock_braintree):
|
def test_it_checks_customer_id(self, mock_braintree):
|
||||||
@ -64,4 +63,4 @@ class PdfInvoiceTestCase(BaseTestCase):
|
|||||||
|
|
||||||
self.client.login(username="alice@example.org", password="password")
|
self.client.login(username="alice@example.org", password="password")
|
||||||
r = self.client.get("/invoice/pdf/abc123/")
|
r = self.client.get("/invoice/pdf/abc123/")
|
||||||
self.assertTrue(six.b("Alice and Partners") in r.content)
|
self.assertTrue(b"Alice and Partners" in r.content)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from io import BytesIO
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import (HttpResponseBadRequest, HttpResponseForbidden,
|
from django.http import (HttpResponseBadRequest, HttpResponseForbidden,
|
||||||
@ -5,7 +7,6 @@ from django.http import (HttpResponseBadRequest, HttpResponseForbidden,
|
|||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
import six
|
|
||||||
from hc.api.models import Check
|
from hc.api.models import Check
|
||||||
from hc.lib import emails
|
from hc.lib import emails
|
||||||
from hc.payments.forms import InvoiceEmailingForm
|
from hc.payments.forms import InvoiceEmailingForm
|
||||||
@ -215,7 +216,7 @@ def charge_webhook(request):
|
|||||||
if sub.send_invoices:
|
if sub.send_invoices:
|
||||||
filename = "MS-HC-%s.pdf" % tx.id.upper()
|
filename = "MS-HC-%s.pdf" % tx.id.upper()
|
||||||
|
|
||||||
sink = six.BytesIO()
|
sink = BytesIO()
|
||||||
PdfInvoice(sink).render(tx, sub.flattened_address())
|
PdfInvoice(sink).render(tx, sub.flattened_address())
|
||||||
ctx = {"tx": tx}
|
ctx = {"tx": tx}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user