Fix up Appveyor testing

This commit is contained in:
Cory Benfield
2017-04-24 08:22:56 +01:00
parent 8db8a7d82d
commit d89f8c0d70
5 changed files with 27 additions and 11 deletions
+2
View File
@@ -11,6 +11,8 @@ Release History
``get_redirect_target(response)`` instead of directly
querying ``Response.is_redirect`` and ``Response.headers['location']``.
Advanced users will be able to process malformed redirects more easily.
- Changed the internal calculation of elapsed request time to have higher
resolution on Windows.
2.13.0 (2017-01-24)
+++++++++++++++++++
+1
View File
@@ -4,6 +4,7 @@ init:
pip install pipenv
pipenv lock
pipenv install --dev
pipenv run pip install -e .[socks]
test:
# This runs all of the tests. To run an individual test, run py.test with
+8 -8
View File
@@ -5,11 +5,6 @@ build: off
environment:
matrix:
- PYTHON: "C:\\Python266-x64"
PYTHON_VERSION: "2.6.6"
PYTHON_ARCH: "64"
TOXENV: "py26"
- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
@@ -30,6 +25,11 @@ environment:
PYTHON_ARCH: "64"
TOXENV: "py35"
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
TOXENV: "py36"
install:
# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
@@ -47,10 +47,10 @@ install:
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"
- "mingw32-make"
- "C:\\MinGW\\bin\\mingw32-make"
test_script:
- "mingw32-make coverage"
- "C:\\MinGW\\bin\\mingw32-make coverage"
on_success:
- "pipenv run codecov"
- "pipenv run codecov -f coverage.xml"
+15 -3
View File
@@ -8,8 +8,10 @@ This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
import platform
import time
from collections import Mapping
from datetime import datetime
from datetime import timedelta
from .auth import _basic_auth_str
from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse
@@ -38,6 +40,15 @@ from .models import REDIRECT_STATI
REDIRECT_CACHE_SIZE = 1000
# Preferred clock, based on which one is more accurate on a given system.
if platform.system() == 'Windows':
try: # Python 3.3+
preferred_clock = time.perf_counter
except AttributeError: # Earlier than Python 3.
preferred_clock = time.clock
else:
preferred_clock = time.time
def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
"""Determines appropriate setting for a given request, taking into account
@@ -622,13 +633,14 @@ class Session(SessionRedirectMixin):
adapter = self.get_adapter(url=request.url)
# Start time (approximately) of the request
start = datetime.utcnow()
start = preferred_clock()
# Send the request
r = adapter.send(request, **kwargs)
# Total elapsed time of the request (approximately)
r.elapsed = datetime.utcnow() - start
elapsed = preferred_clock() - start
r.elapsed = timedelta(seconds=elapsed)
# Response manipulation hooks
r = dispatch_hook('response', hooks, r, **kwargs)
+1
View File
@@ -97,6 +97,7 @@ setup(
extras_require={
'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],
'socks': ['PySocks>=1.5.6, !=1.5.7'],
'socks:platform_system == "Windows" and python_version<"3.3"': ['win_inet_pton'],
},
)