mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 06:46:15 +00:00
Fix up Appveyor testing
This commit is contained in:
@@ -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)
|
||||
+++++++++++++++++++
|
||||
|
||||
@@ -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
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user