Compare commits
30 Commits
master
...
modularize
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbdbab3d16 | ||
|
|
3695acb020 | ||
|
|
f689af0fc6 | ||
|
|
44bc5d2bef | ||
|
|
557e662a6c | ||
|
|
395553f089 | ||
|
|
16b8aec1d7 | ||
|
|
93e13b528f | ||
|
|
5cba294b76 | ||
|
|
dfeb19ff68 | ||
|
|
6888a5aae1 | ||
|
|
0e7160e8e6 | ||
|
|
5ec8fa590d | ||
|
|
f009711526 | ||
|
|
de594188e5 | ||
|
|
989c440700 | ||
|
|
d28c8f18b0 | ||
|
|
3c81acc96c | ||
|
|
8f5faafada | ||
|
|
3ffb447210 | ||
|
|
1f16fb3cfe | ||
|
|
71b456594f | ||
|
|
feb7f6bff1 | ||
|
|
79c3a19792 | ||
|
|
3b29d5701d | ||
|
|
9ef5620b58 | ||
|
|
b846f4dd88 | ||
|
|
bab7a9d88e | ||
|
|
88565d5acd | ||
|
|
42bbc21546 |
65
.travis.yml
65
.travis.yml
@ -1,54 +1,35 @@
|
|||||||
language: python
|
language: python
|
||||||
|
|
||||||
addons:
|
python:
|
||||||
apt:
|
- 2.7
|
||||||
sources:
|
|
||||||
- deadsnakes
|
|
||||||
packages:
|
|
||||||
- python2.4
|
|
||||||
- python2.5
|
|
||||||
- python2.6
|
|
||||||
- python3.2
|
|
||||||
- python3.3
|
|
||||||
|
|
||||||
matrix:
|
env:
|
||||||
include:
|
- TOXENV=py24
|
||||||
- python: 2.7
|
- TOXENV=py25
|
||||||
env: TOXENV=flake8
|
- TOXENV=py26
|
||||||
- python: 2.7
|
- TOXENV=py27
|
||||||
env: TOXENV=py24
|
- TOXENV=py31
|
||||||
- python: 2.7
|
- TOXENV=py32
|
||||||
env: TOXENV=py25
|
- TOXENV=py33
|
||||||
- python: 2.7
|
- TOXENV=py34
|
||||||
env: TOXENV=py26
|
- TOXENV=pypy
|
||||||
- python: 2.7
|
- TOXENV=flake8
|
||||||
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:
|
before_install:
|
||||||
- if [[ $(echo "$TOXENV" | egrep -c "py35") != 0 ]]; then pyenv global system 3.5; fi;
|
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[14])") != 0 ]]; then sudo add-apt-repository -y ppa:fkrull/deadsnakes; fi;
|
||||||
|
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py3[14])") != 0 ]]; then sudo apt-get update -qq; fi;
|
||||||
|
- if [[ "$TOXENV" == "py24" ]]; then sudo apt-get install -y python2.4; fi;
|
||||||
|
- if [[ "$TOXENV" == "py25" ]]; then sudo apt-get install -y python2.5; fi;
|
||||||
|
- if [[ "$TOXENV" == "py31" ]]; then sudo apt-get install -y python3.1; fi;
|
||||||
|
- if [[ "$TOXENV" == "py34" ]]; then sudo apt-get install -y python3.4; fi;
|
||||||
|
- if [[ "$TOXENV" == "pypy" ]]; then sudo apt-get install -y pypy; fi;
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [[ $(echo "$TOXENV" | egrep -c "py32") != 0 ]]; then pip install setuptools==17.1.1; fi;
|
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py31)") != 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 virtualenv==1.7.2 tox==1.3; fi;
|
- if [[ $(echo "$TOXENV" | egrep -c "(py2[45]|py31)") == 0 ]]; then pip install tox; fi;
|
||||||
- if [[ $(echo "$TOXENV" | egrep -c "(py26|py33)") != 0 ]]; then pip install virtualenv==15.2.0 tox==2.9.1; fi;
|
|
||||||
- if [[ $(echo "$TOXENV" | egrep -c "(py2[456]|py3[123])") == 0 ]]; then pip install tox; fi;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- tox
|
- tox
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|||||||
@ -1,34 +1,14 @@
|
|||||||
# Pull Requests
|
# Pull Requests
|
||||||
|
|
||||||
## Pull requests should be
|
Pull requests should be made against the `working` branch.
|
||||||
|
|
||||||
1. Made against the `devel` branch.
|
|
||||||
1. Made from a git feature branch.
|
|
||||||
|
|
||||||
## Pull requests will not be accepted that
|
|
||||||
|
|
||||||
1. Are not made against the `devel` branch
|
|
||||||
1. Are submitted from a branch named `devel`
|
|
||||||
1. Do not pass pep8/pyflakes/flake8
|
|
||||||
1. Do not work with Python 2.4-3.4 or pypy
|
|
||||||
1. Add python modules not included with the Python standard library
|
|
||||||
1. Are made by editing files via the GitHub website
|
|
||||||
|
|
||||||
# Coding Guidelines
|
# Coding Guidelines
|
||||||
|
|
||||||
In general, I follow strict pep8 and pyflakes. All code must pass these tests. Since we support python 2.4-3.4 and pypy, pyflakes reports unknown names in python 3. pyflakes is run in python 2.7 only in my tests.
|
In general, I follow strict pep8 and pyflakes. All code must pass these tests. Since we support python 2.4-3.4, pyflakes reports unknown names in python 3. pyflakes is run in python 2.7 only in my tests.
|
||||||
|
|
||||||
## Some other points
|
|
||||||
|
|
||||||
1. Do not use `\` for line continuations, long strings should be wrapped in `()`. Imports should start a brand new line in the form of `from foo import...`
|
|
||||||
1. String quoting should be done with single quotes `'`, except for situations where you would otherwise have to escape an internal single quote
|
|
||||||
1. Docstrings should use three double quotes `"""`
|
|
||||||
1. All functions, classes and modules should have docstrings following both the PEP257 and PEP8 standards
|
|
||||||
1. Inline comments should only be used on code where it is not immediately obvious what the code achieves
|
|
||||||
|
|
||||||
# Supported Python Versions
|
# Supported Python Versions
|
||||||
|
|
||||||
All code needs to support Python 2.4-3.4 and pypy.
|
All code needs to support Python 2.4-3.4.
|
||||||
|
|
||||||
# Permitted Python Modules
|
# Permitted Python Modules
|
||||||
|
|
||||||
|
|||||||
105
README.rst
105
README.rst
@ -1,31 +1,23 @@
|
|||||||
#Usage
|
|
||||||
|
|
||||||
$ curl -s https://git.spectre5.com/adamcruz/speedtest-cli-pub/raw/branch/master/speedtest.py | python -
|
|
||||||
|
|
||||||
speedtest-cli
|
speedtest-cli
|
||||||
=============
|
=============
|
||||||
|
|
||||||
Command line interface for testing internet bandwidth using
|
Command line interface for testing internet bandwidth using
|
||||||
speedtest.net
|
speedtest.net
|
||||||
|
|
||||||
.. image:: https://img.shields.io/pypi/v/speedtest-cli.svg
|
.. image:: https://pypip.in/v/speedtest-cli/badge.png
|
||||||
:target: https://pypi.python.org/pypi/speedtest-cli/
|
:target: https://pypi.python.org/pypi/speedtest-cli/
|
||||||
:alt: Latest Version
|
:alt: Latest Version
|
||||||
.. image:: https://img.shields.io/travis/sivel/speedtest-cli.svg
|
.. image:: https://pypip.in/d/speedtest-cli/badge.png
|
||||||
:target: https://pypi.python.org/pypi/speedtest-cli/
|
:target: https://pypi.python.org/pypi/speedtest-cli/
|
||||||
:alt: Travis
|
:alt: Downloads
|
||||||
.. image:: https://img.shields.io/pypi/l/speedtest-cli.svg
|
.. image:: https://pypip.in/license/speedtest-cli/badge.png
|
||||||
:target: https://pypi.python.org/pypi/speedtest-cli/
|
:target: https://pypi.python.org/pypi/speedtest-cli/
|
||||||
:alt: License
|
:alt: License
|
||||||
|
|
||||||
Versions
|
Versions
|
||||||
--------
|
--------
|
||||||
|
|
||||||
speedtest-cli works with Python 2.4-3.7
|
speedtest-cli works with Python 2.4-3.4
|
||||||
|
|
||||||
.. image:: https://img.shields.io/pypi/pyversions/speedtest-cli.svg
|
|
||||||
:target: https://pypi.python.org/pypi/speedtest-cli/
|
|
||||||
:alt: Versions
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@ -62,14 +54,14 @@ Just download (Like the way it used to be)
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
|
wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
|
||||||
chmod +x speedtest-cli
|
chmod +x speedtest-cli
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
|
curl -o speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
|
||||||
chmod +x speedtest-cli
|
chmod +x speedtest-cli
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -78,78 +70,21 @@ Usage
|
|||||||
::
|
::
|
||||||
|
|
||||||
$ speedtest-cli -h
|
$ speedtest-cli -h
|
||||||
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
|
usage: speedtest-cli [-h] [--share] [--simple] [--list] [--server SERVER]
|
||||||
[--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
|
[--mini MINI] [--source SOURCE] [--version]
|
||||||
[--csv-header] [--json] [--list] [--server SERVER]
|
|
||||||
[--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
|
|
||||||
[--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.
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
https://github.com/sivel/speedtest-cli
|
https://github.com/sivel/speedtest-cli
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
--no-download Do not perform download test
|
--share Generate and provide a URL to the speedtest.net share
|
||||||
--no-upload Do not perform upload test
|
results image
|
||||||
--bytes Display values in bytes instead of bits. Does not
|
--simple Suppress verbose output, only show basic information
|
||||||
affect the image generated by --share, nor output from
|
--list Display a list of speedtest.net servers sorted by distance
|
||||||
--json or --csv
|
--server SERVER Specify a server ID to test against
|
||||||
--share Generate and provide a URL to the speedtest.net share
|
--mini MINI URL of the Speedtest Mini server
|
||||||
results image, not displayed with --csv
|
--source SOURCE Source IP address to bind to
|
||||||
--simple Suppress verbose output, only show basic information
|
--version Show the version number and exit
|
||||||
--csv Suppress verbose output, only show basic information
|
|
||||||
in CSV format. Speeds listed in bit/s and not affected
|
|
||||||
by --bytes
|
|
||||||
--csv-delimiter CSV_DELIMITER
|
|
||||||
Single character delimiter to use in CSV output.
|
|
||||||
Default ","
|
|
||||||
--csv-header Print CSV headers
|
|
||||||
--json Suppress verbose output, only show basic information
|
|
||||||
in JSON format. Speeds listed in bit/s and not
|
|
||||||
affected by --bytes
|
|
||||||
--list Display a list of speedtest.net servers sorted by
|
|
||||||
distance
|
|
||||||
--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
|
|
||||||
--source SOURCE Source IP address to bind to
|
|
||||||
--timeout TIMEOUT HTTP timeout in seconds. Default 10
|
|
||||||
--secure Use HTTPS instead of HTTP when communicating with
|
|
||||||
speedtest.net operated servers
|
|
||||||
--no-pre-allocate Do not pre allocate upload data. Pre allocation is
|
|
||||||
enabled by default to improve upload performance. To
|
|
||||||
support systems with insufficient memory, use this
|
|
||||||
option to avoid a MemoryError
|
|
||||||
--version Show the version number and exit
|
|
||||||
|
|
||||||
|
|
||||||
Python API
|
|
||||||
----------
|
|
||||||
|
|
||||||
See the `wiki <https://github.com/sivel/speedtest-cli/wiki>`_.
|
|
||||||
|
|
||||||
|
|
||||||
Inconsistency
|
|
||||||
-------------
|
|
||||||
|
|
||||||
It is not a goal of this application to be a reliable latency reporting tool.
|
|
||||||
|
|
||||||
Latency reported by this tool should not be relied on as a value indicative of ICMP
|
|
||||||
style latency. It is a relative value used for determining the lowest latency server
|
|
||||||
for performing the actual speed test against.
|
|
||||||
|
|
||||||
There is the potential for this tool to report results inconsistent with Speedtest.net.
|
|
||||||
There are several concepts to be aware of that factor into the potential inconsistency:
|
|
||||||
|
|
||||||
1. Speedtest.net has migrated to using pure socket tests instead of HTTP based tests
|
|
||||||
2. This application is written in Python
|
|
||||||
3. Different versions of Python will execute certain parts of the code faster than others
|
|
||||||
4. CPU and Memory capacity and speed will play a large part in inconsistency between
|
|
||||||
Speedtest.net and even other machines on the same network
|
|
||||||
|
|
||||||
Issues relating to inconsistencies will be closed as wontfix and without
|
|
||||||
additional reason or context.
|
|
||||||
|
|||||||
84
setup.py
84
setup.py
@ -1,96 +1,28 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2012-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 os
|
import setuptools
|
||||||
import re
|
|
||||||
import codecs
|
|
||||||
|
|
||||||
from setuptools import setup
|
setuptools.setup(
|
||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
|
|
||||||
|
|
||||||
# Read the version number from a source file.
|
|
||||||
# Why read it, and not import?
|
|
||||||
# see https://groups.google.com/d/topic/pypa-dev/0PkjVpcxTzQ/discussion
|
|
||||||
def find_version(*file_paths):
|
|
||||||
# Open in Latin-1 so that we avoid encoding errors.
|
|
||||||
# Use codecs.open for Python 2 compatibility
|
|
||||||
try:
|
|
||||||
f = codecs.open(os.path.join(here, *file_paths), 'r', 'latin1')
|
|
||||||
version_file = f.read()
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
raise RuntimeError("Unable to find version string.")
|
|
||||||
|
|
||||||
# The version line must have the form
|
|
||||||
# __version__ = 'ver'
|
|
||||||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
|
|
||||||
version_file, re.M)
|
|
||||||
if version_match:
|
|
||||||
return version_match.group(1)
|
|
||||||
raise RuntimeError("Unable to find version string.")
|
|
||||||
|
|
||||||
|
|
||||||
# Get the long description from the relevant file
|
|
||||||
try:
|
|
||||||
f = codecs.open('README.rst', encoding='utf-8')
|
|
||||||
long_description = f.read()
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
long_description = ''
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name='speedtest-cli',
|
name='speedtest-cli',
|
||||||
version=find_version('speedtest.py'),
|
version='0.2.5',
|
||||||
description=('Command line interface for testing internet bandwidth using '
|
description=('Command line interface for testing internet bandwidth using '
|
||||||
'speedtest.net'),
|
'speedtest.net'),
|
||||||
long_description=long_description,
|
long_description=open('README.rst').read(),
|
||||||
keywords='speedtest speedtest.net',
|
|
||||||
author='Matt Martz',
|
author='Matt Martz',
|
||||||
author_email='matt@sivel.net',
|
author_email='matt@sivel.net',
|
||||||
url='https://github.com/sivel/speedtest-cli',
|
url='https://github.com/sivel/speedtest-cli',
|
||||||
license='Apache License, Version 2.0',
|
license='Apache License, Version 2.0',
|
||||||
py_modules=['speedtest'],
|
py_modules=['speedtest_cli'],
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'speedtest=speedtest:main',
|
'speedtest=speedtest_cli:main',
|
||||||
'speedtest-cli=speedtest:main'
|
'speedtest-cli=speedtest_cli:main'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Environment :: Console',
|
'Environment :: Console',
|
||||||
'License :: OSI Approved :: Apache Software License',
|
'License :: OSI Approved :: Apache Software License',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent'
|
||||||
'Programming Language :: Python :: 2',
|
|
||||||
'Programming Language :: Python :: 2.4',
|
|
||||||
'Programming Language :: Python :: 2.5',
|
|
||||||
'Programming Language :: Python :: 2.6',
|
|
||||||
'Programming Language :: Python :: 2.7',
|
|
||||||
'Programming Language :: Python :: 3',
|
|
||||||
'Programming Language :: Python :: 3.1',
|
|
||||||
'Programming Language :: Python :: 3.2',
|
|
||||||
'Programming Language :: Python :: 3.3',
|
|
||||||
'Programming Language :: Python :: 3.4',
|
|
||||||
'Programming Language :: Python :: 3.5',
|
|
||||||
'Programming Language :: Python :: 3.6',
|
|
||||||
'Programming Language :: Python :: 3.7',
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
.TH "speedtest-cli" 1 "2018-01-05" "speedtest-cli"
|
.TH "speedtest-cli" 1 "2014-01-26" "speedtest-cli"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
speedtest\-cli \- Command line interface for testing internet bandwidth using speedtest.net
|
speedtest\-cli \- Test your bandwidth througput using speedtest.net
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B speedtest\-cli
|
.B speedtest\-cli
|
||||||
[OPTION...]
|
[OPTION]...
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Speedtest.net is a web service for testing your broadband connection by downloading a file
|
Speedtest.net is a web service for testing your broadband connection by downloading a file
|
||||||
from a nearby speedtest.net server on the web. This tool allows you to access the service
|
from a nearby speedtest.net server on the web. This tool allows you to access the service
|
||||||
@ -23,24 +23,9 @@ Displays usage for the tool.
|
|||||||
|
|
||||||
.B Options
|
.B Options
|
||||||
|
|
||||||
\fB\-\-no\-download\fR
|
|
||||||
.RS
|
|
||||||
Do not perform download test
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-no\-upload\fR
|
|
||||||
.RS
|
|
||||||
Do not perform upload test
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-bytes\fR
|
|
||||||
.RS
|
|
||||||
Display values in bytes instead of bits. Does not affect the image generated by \-\-share, nor output from \-\-json or \-\-csv
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-share\fR
|
\fB\-\-share\fR
|
||||||
.RS
|
.RS
|
||||||
Generate and provide a URL to the speedtest.net share results image, not displayed with \-\-csv
|
Generate and provide a URL to the speedtest.net share results image
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB\-\-simple\fR
|
\fB\-\-simple\fR
|
||||||
@ -48,26 +33,6 @@ Generate and provide a URL to the speedtest.net share results image, not display
|
|||||||
Suppress verbose output, only show basic information
|
Suppress verbose output, only show basic information
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB\-\-csv\fR
|
|
||||||
.RS
|
|
||||||
Suppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by \-\-bytes
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-csv\-delimiter CSV_DELIMITER\fR
|
|
||||||
.RS
|
|
||||||
Single character delimiter to use in CSV output. Default ","
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-csv\-header\fR
|
|
||||||
.RS
|
|
||||||
Print CSV headers
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-json\fR
|
|
||||||
.RS
|
|
||||||
Suppress verbose output, only show basic information in JSON format. Speeds listed in bit/s and not affected by \-\-bytes
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-list\fR
|
\fB\-\-list\fR
|
||||||
.RS
|
.RS
|
||||||
Display a list of speedtest.net servers sorted by distance
|
Display a list of speedtest.net servers sorted by distance
|
||||||
@ -75,12 +40,7 @@ Display a list of speedtest.net servers sorted by distance
|
|||||||
|
|
||||||
\fB\-\-server SERVER\fR
|
\fB\-\-server SERVER\fR
|
||||||
.RS
|
.RS
|
||||||
Specify a server ID to test against. Can be supplied multiple times
|
Specify a server ID to test against
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-exclude EXCLUDE\fR
|
|
||||||
.RS
|
|
||||||
Exclude a server from selection. Can be supplied multiple times
|
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB\-\-mini MINI\fR
|
\fB\-\-mini MINI\fR
|
||||||
@ -93,21 +53,6 @@ URL of the Speedtest Mini server
|
|||||||
Source IP address to bind to
|
Source IP address to bind to
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fB\-\-timeout TIMEOUT\fR
|
|
||||||
.RS
|
|
||||||
HTTP timeout in seconds. Default 10
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-secure\fR
|
|
||||||
.RS
|
|
||||||
Use HTTPS instead of HTTP when communicating with speedtest.net operated servers
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-no\-pre\-allocate\fR
|
|
||||||
.RS
|
|
||||||
Do not pre allocate upload data. Pre allocation is enabled by default to improve upload performance. To support systems with insufficient memory, use this option to avoid a MemoryError
|
|
||||||
.RE
|
|
||||||
|
|
||||||
\fB\-\-version\fR
|
\fB\-\-version\fR
|
||||||
.RS
|
.RS
|
||||||
Show the version number and exit
|
Show the version number and exit
|
||||||
|
|||||||
1895
speedtest.py
1895
speedtest.py
File diff suppressed because it is too large
Load Diff
1077
speedtest_cli.py
Executable file
1077
speedtest_cli.py
Executable file
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
|||||||
#!/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()
|
|
||||||
)
|
|
||||||
12
tox.ini
12
tox.ini
@ -4,22 +4,16 @@ skipsdist=true
|
|||||||
[testenv]
|
[testenv]
|
||||||
commands =
|
commands =
|
||||||
{envpython} -V
|
{envpython} -V
|
||||||
{envpython} -m compileall speedtest.py
|
{envpython} speedtest_cli.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
|
||||||
deps=flake8
|
deps=flake8
|
||||||
commands =
|
commands =
|
||||||
{envpython} -V
|
{envpython} -V
|
||||||
flake8 speedtest.py
|
flake8 speedtest_cli.py
|
||||||
|
|
||||||
[testenv:pypy]
|
[testenv:pypy]
|
||||||
commands =
|
commands =
|
||||||
pypy -V
|
pypy -V
|
||||||
pypy -m compileall speedtest.py
|
pypy speedtest_cli.py
|
||||||
pypy speedtest.py
|
|
||||||
pypy speedtest.py --source 172.17.0.1
|
|
||||||
pypy tests/scripts/source.py
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user