Skip to content

Failing pytester tests with features branch #2946

Closed
@The-Compiler

Description

@The-Compiler

@nicoddemus Let's continue the discussion from #2945 here, as this probably warrants some deeper investigation.

When trying to run my tests (after some patching), I get various failures in my test_check_coverage.py which runs pytest via pytester and produces a coverage.xml via pytest-cov which it then reads.

Here's how it fails:

___________________________________________________________________________________________________________________________________________________ test_tested_no_branches ___________________________________________________________________________________________________________________________________________________

self = <module 'py.error'>, func = <built-in function open>, args = ('/tmp/pytest-of-florian/pytest-229/test_tested_no_branches0/coverage.xml', 'r'), kwargs = {'encoding': 'utf-8'}, __tracebackhide__ = False, cls = <class 'py.error.ENOENT'>, value = FileNotFoundError(2, 'No such file or directory')
tb = <traceback object at 0x7f5bd063f588>, errno = 2

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
>           return func(*args, **kwargs)
E           FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-florian/pytest-229/test_tested_no_branches0/coverage.xml'

/home/florian/proj/qutebrowser/git/.tox/py36/lib/python3.6/site-packages/py/_error.py:66: FileNotFoundError

During handling of the above exception, another exception occurred:

covtest = <test_check_coverage.CovtestHelper object at 0x7f5bff541cf8>

    def test_tested_no_branches(covtest):
        covtest.makefile("""
            def func():
                pass
        """)
        covtest.run()
>       assert covtest.check() == []

/home/florian/proj/qutebrowser/git/tests/unit/scripts/test_check_coverage.py:103: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/florian/proj/qutebrowser/git/tests/unit/scripts/test_check_coverage.py:69: in check
    with coverage_file.open(encoding='utf-8') as f:
/home/florian/proj/qutebrowser/git/.tox/py36/lib/python3.6/site-packages/py/_path/local.py:360: in open
    return py.error.checked_call(io.open, self.strpath, mode, encoding=encoding)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <module 'py.error'>, func = <built-in function open>, args = ('/tmp/pytest-of-florian/pytest-229/test_tested_no_branches0/coverage.xml', 'r'), kwargs = {'encoding': 'utf-8'}, __tracebackhide__ = False, cls = <class 'py.error.ENOENT'>, value = FileNotFoundError(2, 'No such file or directory')
tb = <traceback object at 0x7f5bd063f588>, errno = 2

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
            return func(*args, **kwargs)
        except self.Error:
            raise
        except (OSError, EnvironmentError):
            cls, value, tb = sys.exc_info()
            if not hasattr(value, 'errno'):
                raise
            __tracebackhide__ = False
            errno = value.errno
            try:
                if not isinstance(value, WindowsError):
                    raise NameError
            except NameError:
                # we are not on Windows, or we got a proper OSError
                cls = self._geterrnoclass(errno)
            else:
                try:
                    cls = self._geterrnoclass(_winerrnomap[errno])
                except KeyError:
                    raise value
>           raise cls("%s%r" % (func.__name__, args))
E           py.error.ENOENT: [No such file or directory]: open('/tmp/pytest-of-florian/pytest-229/test_tested_no_branches0/coverage.xml', 'r')

/home/florian/proj/qutebrowser/git/.tox/py36/lib/python3.6/site-packages/py/_error.py:86: ENOENT

I was able to bisect it to 333a9ad but that probably also did some kind of pluggy update?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: criticalgrave problem or usability issue that affects lots of users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions