Switch to pytest 2.8.

Closes #1077.

There were two issues:

- Paths for coverage.py suddenly were absolute instead of relative, so we strip
  the common base part if that happens.

  /home/florian/proj/qutebrowser/git/qutebrowser/browser/cookies.py has 100%
  coverage but is not in perfect_files!
  /home/florian/proj/qutebrowser/git/qutebrowser/browser/http.py has 100%
  coverage but is not in perfect_files!
  [...]

- There was an io.UnsupportedOperationError in test_check_coverage.py because
  of pytest-faulthandler, so we just don't load that in the subprocess.
This commit is contained in:
Florian Bruhin 2015-11-11 20:57:47 +01:00
parent 416cfaf002
commit 3680f01576
3 changed files with 13 additions and 2 deletions

View File

@ -34,6 +34,8 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
from scripts import utils
import qutebrowser
Message = collections.namedtuple('Message', 'typ, text')
MsgType = enum.Enum('MsgType', 'insufficent_coverage, perfect_file')
@ -169,6 +171,14 @@ def check(fileobj, perfect_files):
for klass in classes:
filename = klass.attrib['filename']
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..',
'..'))
if os.path.isabs(filename):
common_path = os.path.commonpath([basedir, filename])
if common_path:
filename = filename[len(common_path):].lstrip('/')
line_cov = float(klass.attrib['line-rate']) * 100
branch_cov = float(klass.attrib['branch-rate']) * 100

View File

@ -51,7 +51,8 @@ class CovtestHelper:
coveragerc = str(self._testdir.tmpdir / 'coveragerc')
return self._testdir.runpytest('--cov=module',
'--cov-config={}'.format(coveragerc),
'--cov-report=xml')
'--cov-report=xml',
plugins=['no:faulthandler'])
def check(self, perfect_files=None):
"""Run check_coverage.py and run its return value."""

View File

@ -26,7 +26,7 @@ deps =
parse==1.6.6
parse-type==0.3.4
py==1.4.30
pytest==2.7.3 # rq.filter: <2.8.0
pytest==2.8.2
pytest-bdd==2.15.0
pytest-catchlog==1.2.0
pytest-cov==2.2.0