Only test modern python/django versions (drops python 2.x)

This commit is contained in:
Quantum 2020-05-22 22:57:18 -04:00
parent cdb265a97a
commit 0ce7e8ca79
2 changed files with 11 additions and 17 deletions

View file

@ -1,25 +1,20 @@
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
env:
- DJANGO_VERSION=""
- DJANGO_VERSION=">=1.8,<1.9"
- DJANGO_VERSION=">=1.9,<1.10"
- DJANGO_VERSION=">=1.10,<1.11"
- DJANGO_VERSION=">=1.11,<2"
- DJANGO_VERSION=">=2,<2.1"
- DJANGO_VERSION=">=2.1,<2.2"
- DJANGO_VERSION=">=2.2,<3"
- DJANGO_VERSION=">=3,<3.1"
matrix:
exclude:
- python: "2.7"
env: DJANGO_VERSION=">=2,<2.1"
- python: "2.7"
env: DJANGO_VERSION=">=2.1,<2.2"
- python: "3.4"
env: DJANGO_VERSION=">=2.1,<2.2"
- python: "3.5"
env: DJANGO_VERSION=">=3,<3.1"
install:
- pip install codecov $([ -n "$DJANGO_VERSION" ] && echo "Django$DJANGO_VERSION")
script:

View file

@ -1,17 +1,16 @@
import inspect
import logging
import os
import time
from copy import copy
from functools import wraps
from numbers import Number
from time import perf_counter
from optimize_later.config import global_callback
from optimize_later.utils import NoArgDecoratorMeta, with_metaclass
from optimize_later import utils
log = logging.getLogger(__name__.rpartition('.')[0] or __name__)
timer = [time.time, time.clock][os.name == 'nt']
def _generate_default_name():
@ -39,11 +38,11 @@ class OptimizeBlock(object):
def __enter__(self):
assert self.start is None, 'Do not reuse blocks.'
self.start = timer()
self.start = perf_counter()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.end = timer()
self.end = perf_counter()
self.delta = self.end - self.start
def short(self, precision=3):
@ -115,11 +114,11 @@ class optimize_later(with_metaclass(NoArgDecoratorMeta)):
def __enter__(self):
assert self.start is None, 'Do not reuse optimize_later objects.'
self.start = timer()
self.start = perf_counter()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.end = timer()
self.end = perf_counter()
self.delta = self.end - self.start
if self.delta >= self.limit:
self._report()