diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml new file mode 100644 index 0000000..c56b1fd --- /dev/null +++ b/.github/workflows/python-package.yaml @@ -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 diff --git a/setup.py b/setup.py index f3d21ad..752b0b0 100644 --- a/setup.py +++ b/setup.py @@ -80,15 +80,8 @@ setup( 'License :: OSI Approved :: Apache Software License', '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', diff --git a/speedtest.py b/speedtest.py index 186b529..433e785 100755 --- a/speedtest.py +++ b/speedtest.py @@ -220,12 +220,12 @@ else: return def write(data): - if not isinstance(data, basestring): + if not isinstance(data, basestring): # noqa data = str(data) # If the file has an encoding, encode unicode with it. encoding = 'utf8' # Always trust UTF-8 for output - if (isinstance(fp, file) and - isinstance(data, unicode) and + if (isinstance(fp, file) and # noqa + isinstance(data, unicode) and # noqa encoding is not None): errors = getattr(fp, "errors", None) if errors is None: @@ -236,13 +236,13 @@ else: want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: - if isinstance(sep, unicode): + if isinstance(sep, unicode): # noqa want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: - if isinstance(end, unicode): + if isinstance(end, unicode): # noqa want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") @@ -250,12 +250,12 @@ else: raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: - if isinstance(arg, unicode): + if isinstance(arg, unicode): # noqa want_unicode = True break if want_unicode: - newline = unicode("\n") - space = unicode(" ") + newline = unicode("\n") # noqa + space = unicode(" ") # noqa else: newline = "\n" space = " " diff --git a/tox.ini b/tox.ini index 8a63b5b..3ac4844 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] +envlist=py27,py35,py36,py37,py38,py39,pypy skipsdist=true [testenv] @@ -15,11 +16,3 @@ deps=flake8 commands = {envpython} -V 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