Fix up Appveyor testing
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Cory Benfield · committed by Cory Benfield · parent 8db8a7d · Browse files · 5 files·+27 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+27 added−11 removed
- other:+27 added−11 removed
Provenance
- Commit
d89f8c0- Tree
634f8f0- Author
Cory Benfield <lukasaoz@gmail.com>- Committer
Cory Benfield <lukasaoz@gmail.com>- Parent
8db8a7d
5 files changed+27 added−11 removed
modified:requests/sessions.py+15 added-3 removed
6 unmodified lines7 This module provides a Session object to manage and persist settings across8 requests (cookies, auth, proxies).9 """10 import os11+import platform12+import time13 from collections import Mapping12-from datetime import datetime14+from datetime import timedelta15 16 from .auth import _basic_auth_str17 from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse18 from .cookies import (20 unmodified lines39 from .models import REDIRECT_STATI40 41 REDIRECT_CACHE_SIZE = 100042 43+# Preferred clock, based on which one is more accurate on a given system.44+if platform.system() == 'Windows':45+ try: # Python 3.3+46+ preferred_clock = time.perf_counter47+ except AttributeError: # Earlier than Python 3.48+ preferred_clock = time.clock49+else:50+ preferred_clock = time.time51 52+53 def merge_setting(request_setting, session_setting, dict_class=OrderedDict):54 """Determines appropriate setting for a given request, taking into account55 the explicit setting on that request, and the setting in the session. If a56 setting is a dictionary, they will be merged together using `dict_class`575 unmodified lines632 # Get the appropriate adapter to use633 adapter = self.get_adapter(url=request.url)634 635 # Start time (approximately) of the request625- start = datetime.utcnow()636+ start = preferred_clock()637 638 # Send the request639 r = adapter.send(request, **kwargs)640 641 # Total elapsed time of the request (approximately)631- r.elapsed = datetime.utcnow() - start642+ elapsed = preferred_clock() - start643+ r.elapsed = timedelta(seconds=elapsed)644 645 # Response manipulation hooks646 r = dispatch_hook('response', hooks, r, **kwargs)647 110 unmodified linesmodified:appveyor.yml+8 added-8 removed
3 unmodified lines45678910111289101112 unmodified lines242526272829303132333435369 unmodified lines46474849505051525353545556563 unmodified linesbuild: 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" TOXENV: "py27"12 unmodified lines PYTHON_VERSION: "3.5.x" 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. - ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\install.ps1 }9 unmodified lines
# 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"modified:HISTORY.rst+2 added
9 unmodified lines10 ``resolve_redirects`` will now detect a redirect by calling11 ``get_redirect_target(response)`` instead of directly12 querying ``Response.is_redirect`` and ``Response.headers['location']``.13 Advanced users will be able to process malformed redirects more easily.14+- Changed the internal calculation of elapsed request time to have higher15+ resolution on Windows.16 17 2.13.0 (2017-01-24)18 +++++++++++++++++++19 1300 unmodified linesmodified:Makefile+1 added
2 unmodified lines3 init:4 pip install pipenv5 pipenv lock6 pipenv install --dev7+ pipenv run pip install -e .[socks]8 9 test:10 # This runs all of the tests. To run an individual test, run py.test with11 # the -k flag, like "py.test -k test_path_is_not_double_encoded"47 unmodified linesmodified:setup.py+1 added
95 unmodified lines96 tests_require=test_requirements,97 extras_require={98 'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],99 'socks': ['PySocks>=1.5.6, !=1.5.7'],100+ 'socks:platform_system == "Windows" and python_version<"3.3"': ['win_inet_pton'],101 },102 )103