Skip to content

Commit

Permalink
Merge fixes from erikkemberman@
Browse files Browse the repository at this point in the history
Removes Python 2 support as well as dependency on py; fixes #81 #82
  • Loading branch information
tholo committed Mar 5, 2022
2 parents e7d9ce0 + 48dd965 commit 8bfb90f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ language: python
cache: pip
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
Expand All @@ -19,8 +15,10 @@ matrix:
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: pypy2.7-6.0
env: TOXENV=pypy
- python: 3.9
env: TOXENV=py39
- python: 3.10
env: TOXENV=py310
- python: pypy3.5-6.0
env: TOXENV=pypy3
install:
Expand Down
29 changes: 18 additions & 11 deletions pytest_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import os
import re
from contextlib import redirect_stdout, redirect_stderr
from io import BytesIO, TextIOWrapper

from flake8.main import application
from flake8.options import config

import py

import pytest

__version__ = '0.6'
Expand Down Expand Up @@ -116,15 +116,22 @@ def setup(self):
pytest.skip("file(s) previously passed FLAKE8 checks")

def runtest(self):
call = py.io.StdCapture.call
found_errors, out, err = call(
check_file,
self.fspath,
self.flake8ignore,
self.maxlength,
self.maxcomplexity,
self.showshource,
self.statistics)
with BytesIO() as bo, TextIOWrapper(bo, encoding='utf-8') as to, \
BytesIO() as be, TextIOWrapper(be, encoding='utf-8') as te, \
redirect_stdout(to), redirect_stderr(te):
found_errors = check_file(
self.fspath,
self.flake8ignore,
self.maxlength,
self.maxcomplexity,
self.showshource,
self.statistics
)
to.flush()
te.flush()
out = bo.getvalue().decode('utf-8')
err = be.getvalue().decode('utf-8')

if found_errors:
raise Flake8Error(out, err)
# update mtime only if test passed
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist=py27,py36-pytesttrunk,py36-xdist,py34,py35,py36,py37,py38,pypy,pypy3
envlist=py36-pytesttrunk,py36-xdist,py35,py36,py37,py38,py39,py310,pypy3

[testenv]
deps=pytest
Expand Down

0 comments on commit 8bfb90f

Please sign in to comment.