Merge branch 'devel' of https://github.com/sivel/speedtest-cli into party98

This commit is contained in:
Parth Verma 2018-01-18 19:35:54 +05:30
commit d6feef88b8
6 changed files with 587 additions and 197 deletions

View File

@ -1,8 +1,5 @@
language: python language: python
python:
- 2.7
addons: addons:
apt: apt:
sources: sources:
@ -11,26 +8,44 @@ addons:
- python2.4 - python2.4
- python2.5 - python2.5
- python2.6 - python2.6
- pypy - python3.2
- python3.3
env: matrix:
- TOXENV=py24 include:
- TOXENV=py25 - python: 2.7
- TOXENV=py26 env: TOXENV=flake8
- TOXENV=py27 - python: 2.7
- TOXENV=py32 env: TOXENV=py24
- TOXENV=py33 - python: 2.7
- TOXENV=py34 env: TOXENV=py25
- TOXENV=py35 - python: 2.7
- TOXENV=pypy env: TOXENV=py26
- TOXENV=flake8 - python: 2.7
env: TOXENV=py27
- python: 2.7
env: TOXENV=py32
- python: 2.7
env: TOXENV=py33
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: pypy
env: TOXENV=pypy
before_install:
- if [[ $(echo "$TOXENV" | egrep -c "py35") != 0 ]]; then pyenv global system 3.5; fi;
install: install:
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") != 0 ]]; then pip install virtualenv==1.7.2 tox==1.3; fi; - if [[ $(echo "$TOXENV" | egrep -c "py32") != 0 ]]; then pip install setuptools==17.1.1; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") == 0 ]]; then pip install tox; fi; - if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") != 0 ]]; then pip install virtualenv==1.7.2 tox==1.3; fi;
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[12])") == 0 ]]; then pip install tox; fi;
script: script:
- tox - tox
notifications: notifications:
email: email:

View File

@ -17,7 +17,7 @@ speedtest.net
Versions Versions
-------- --------
speedtest-cli works with Python 2.4-3.5 speedtest-cli works with Python 2.4-3.6
.. image:: https://img.shields.io/pypi/pyversions/speedtest-cli.svg .. image:: https://img.shields.io/pypi/pyversions/speedtest-cli.svg
:target: https://pypi.python.org/pypi/speedtest-cli/ :target: https://pypi.python.org/pypi/speedtest-cli/
@ -77,8 +77,9 @@ Usage
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share] usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
[--simple] [--csv] [--csv-delimiter CSV_DELIMITER] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
[--csv-header] [--json] [--list] [--server SERVER] [--csv-header] [--json] [--list] [--server SERVER]
[--mini MINI] [--source SOURCE] [--timeout TIMEOUT] [--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
[--secure] [--no-pre-allocate] [--version] [--timeout TIMEOUT] [--secure] [--no-pre-allocate]
[--version]
Command line interface for testing internet bandwidth using speedtest.net. Command line interface for testing internet bandwidth using speedtest.net.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
@ -106,7 +107,10 @@ Usage
affected by --bytes affected by --bytes
--list Display a list of speedtest.net servers sorted by --list Display a list of speedtest.net servers sorted by
distance distance
--server SERVER Specify a server ID to test against --server SERVER Specify a server ID to test against. Can be supplied
multiple times
--exclude EXCLUDE Exclude a server from selection. Can be supplied
multiple times
--mini MINI URL of the Speedtest Mini server --mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to --source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10 --timeout TIMEOUT HTTP timeout in seconds. Default 10

View File

@ -90,5 +90,6 @@ setup(
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
] ]
) )

File diff suppressed because it is too large Load Diff

37
tests/scripts/source.py Normal file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sys
import subprocess
cmd = [sys.executable, 'speedtest.py', '--source', '127.0.0.1']
p = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, stderr = p.communicate()
if p.returncode != 1:
raise SystemExit('%s did not fail with exit code 1' % ' '.join(cmd))
if 'Invalid argument'.encode() not in stderr:
raise SystemExit(
'"Invalid argument" not found in stderr:\n%s' % stderr.decode()
)

View File

@ -6,6 +6,8 @@ commands =
{envpython} -V {envpython} -V
{envpython} -m compileall speedtest.py {envpython} -m compileall speedtest.py
{envpython} speedtest.py {envpython} speedtest.py
{envpython} speedtest.py --source 172.17.0.1
{envpython} tests/scripts/source.py
[testenv:flake8] [testenv:flake8]
basepython=python basepython=python
@ -19,3 +21,5 @@ commands =
pypy -V pypy -V
pypy -m compileall speedtest.py pypy -m compileall speedtest.py
pypy speedtest.py pypy speedtest.py
pypy speedtest.py --source 172.17.0.1
pypy tests/scripts/source.py