Merge 8a7d46f85e
into 22210ca352
This commit is contained in:
commit
cb1f786e23
|
@ -0,0 +1,34 @@
|
||||||
|
name: Python package
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
- "3.5"
|
||||||
|
- "3.6"
|
||||||
|
- "3.7"
|
||||||
|
- "3.8"
|
||||||
|
- "3.9"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: Install Tox and any other packages
|
||||||
|
run: pip install tox
|
||||||
|
- name: Run Tox
|
||||||
|
# Run tox using the version of Python in `PATH`
|
||||||
|
run: tox -e py
|
||||||
|
- name: Run flake8
|
||||||
|
run: tox -e flake8
|
7
setup.py
7
setup.py
|
@ -80,15 +80,8 @@ setup(
|
||||||
'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',
|
||||||
'Programming Language :: Python :: 2.4',
|
|
||||||
'Programming Language :: Python :: 2.5',
|
|
||||||
'Programming Language :: Python :: 2.6',
|
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
'Programming Language :: Python :: 3',
|
'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.5',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3.6',
|
||||||
'Programming Language :: Python :: 3.7',
|
'Programming Language :: Python :: 3.7',
|
||||||
|
|
16
speedtest.py
16
speedtest.py
|
@ -220,12 +220,12 @@ else:
|
||||||
return
|
return
|
||||||
|
|
||||||
def write(data):
|
def write(data):
|
||||||
if not isinstance(data, basestring):
|
if not isinstance(data, basestring): # noqa
|
||||||
data = str(data)
|
data = str(data)
|
||||||
# If the file has an encoding, encode unicode with it.
|
# If the file has an encoding, encode unicode with it.
|
||||||
encoding = 'utf8' # Always trust UTF-8 for output
|
encoding = 'utf8' # Always trust UTF-8 for output
|
||||||
if (isinstance(fp, file) and
|
if (isinstance(fp, file) and # noqa
|
||||||
isinstance(data, unicode) and
|
isinstance(data, unicode) and # noqa
|
||||||
encoding is not None):
|
encoding is not None):
|
||||||
errors = getattr(fp, "errors", None)
|
errors = getattr(fp, "errors", None)
|
||||||
if errors is None:
|
if errors is None:
|
||||||
|
@ -236,13 +236,13 @@ else:
|
||||||
want_unicode = False
|
want_unicode = False
|
||||||
sep = kwargs.pop("sep", None)
|
sep = kwargs.pop("sep", None)
|
||||||
if sep is not None:
|
if sep is not None:
|
||||||
if isinstance(sep, unicode):
|
if isinstance(sep, unicode): # noqa
|
||||||
want_unicode = True
|
want_unicode = True
|
||||||
elif not isinstance(sep, str):
|
elif not isinstance(sep, str):
|
||||||
raise TypeError("sep must be None or a string")
|
raise TypeError("sep must be None or a string")
|
||||||
end = kwargs.pop("end", None)
|
end = kwargs.pop("end", None)
|
||||||
if end is not None:
|
if end is not None:
|
||||||
if isinstance(end, unicode):
|
if isinstance(end, unicode): # noqa
|
||||||
want_unicode = True
|
want_unicode = True
|
||||||
elif not isinstance(end, str):
|
elif not isinstance(end, str):
|
||||||
raise TypeError("end must be None or a string")
|
raise TypeError("end must be None or a string")
|
||||||
|
@ -250,12 +250,12 @@ else:
|
||||||
raise TypeError("invalid keyword arguments to print()")
|
raise TypeError("invalid keyword arguments to print()")
|
||||||
if not want_unicode:
|
if not want_unicode:
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if isinstance(arg, unicode):
|
if isinstance(arg, unicode): # noqa
|
||||||
want_unicode = True
|
want_unicode = True
|
||||||
break
|
break
|
||||||
if want_unicode:
|
if want_unicode:
|
||||||
newline = unicode("\n")
|
newline = unicode("\n") # noqa
|
||||||
space = unicode(" ")
|
space = unicode(" ") # noqa
|
||||||
else:
|
else:
|
||||||
newline = "\n"
|
newline = "\n"
|
||||||
space = " "
|
space = " "
|
||||||
|
|
9
tox.ini
9
tox.ini
|
@ -1,4 +1,5 @@
|
||||||
[tox]
|
[tox]
|
||||||
|
envlist=py27,py35,py36,py37,py38,py39,pypy
|
||||||
skipsdist=true
|
skipsdist=true
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
@ -15,11 +16,3 @@ deps=flake8
|
||||||
commands =
|
commands =
|
||||||
{envpython} -V
|
{envpython} -V
|
||||||
flake8 speedtest.py
|
flake8 speedtest.py
|
||||||
|
|
||||||
[testenv:pypy]
|
|
||||||
commands =
|
|
||||||
pypy -V
|
|
||||||
pypy -m compileall speedtest.py
|
|
||||||
pypy speedtest.py
|
|
||||||
pypy speedtest.py --source 172.17.0.1
|
|
||||||
pypy tests/scripts/source.py
|
|
||||||
|
|
Loading…
Reference in New Issue