question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest-profiling 1.7.0: pytest is failing

See original GitHub issue

I’m trying to package your module as rpm packag. So I’m using typical in such case build, install and test cycle used on building package from non-root account:

  • “setup.py build”
  • “setup.py install --root </install/prefix>”
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-profiling-1.7.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-profiling-1.7.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-profiling-1.7.0, configfile: setup.cfg
plugins: profiling-1.7.0, forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6
collected 14 items

. F                                                                                                                                                                  [  7%]
tests/integration/test_profile_integration.py EEEE                                                                                                                   [ 38%]
tests/unit/test_profile.py ........                                                                                                                                  [100%]

================================================================================== ERRORS ==================================================================================
______________________________________________________________ ERROR at setup of test_profile_profiles_tests _______________________________________________________________

    @pytest.yield_fixture(scope='session')
    def virtualenv():
        with VirtualEnv() as venv:
            test_dir = resource_filename('pytest_profiling',
                                     'tests/integration/profile')

            # HACK: pin more-itertools to 5.0.0 to keep tests working in PY27 as
            # as that's a py3 only release
>           venv.install_package('more-itertools==5.0.0')

tests/integration/test_profile_integration.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:212: in install_package
    self.run(cmd, capture=False)
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:151: in run
    return super(VirtualEnv, self).run(args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_virtualenv.VirtualEnv object at 0x7f6ff3f579d0>, cmd = '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0'
capture = False, check_rc = True, cd = Path('/tmp/tmpnhj6t1w6'), shell = True
kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_FUNC_which%%': '() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tt...es -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none', ...}}
p = <subprocess.Popen object at 0x7f6ff3f57a30>, out = None, _ = None
err = CalledProcessError(2, '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0')

    def run(self, cmd, capture=False, check_rc=True, cd=None, shell=False, **kwargs):
        """
        Run a command relative to a given directory, defaulting to the workspace root

        Parameters
        ----------
        cmd : `str` or `list`
            Command string or list. Commands given as a string will be run in a subshell.
        capture : `bool`
            Capture and return output
        check_rc : `bool`
            Assert return code is zero
        cd : `str`
            Path to chdir to, defaults to workspace root
        """
        if isinstance(cmd, string_types):
            shell = True
        else:
            # Some of the command components might be path objects or numbers
            cmd = [str(i) for i in cmd]

        if not cd:
            cd = self.workspace

        with cmdline.chdir(cd):
            log.debug("run: {0}".format(cmd))
            if capture:
                p = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs)
            else:
                p = subprocess.Popen(cmd, shell=shell, **kwargs)
            (out, _) = p.communicate()

            if out is not None and not isinstance(out, string_types):
                out = out.decode('utf-8')

            if self.debug and capture:
                log.debug("Stdout/stderr:")
                log.debug(out)

            if check_rc and p.returncode != 0:
                err = subprocess.CalledProcessError(p.returncode, cmd)
                err.output = out
                if capture and not self.debug:
                    log.error("Stdout/stderr:")
                    log.error(out)
>               raise err
E               subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0' returned non-zero exit status 2.

/usr/lib/python3.8/site-packages/pytest_shutil/workspace.py:132: CalledProcessError
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------
created virtual environment CPython3.8.11.final.0-64 in 290ms
  creator CPython3Posix(dest=/tmp/tmpnhj6t1w6/.env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
    added seed packages: pip==21.1.3, setuptools==57.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
-------------------------------------------------------------------------- Captured stderr setup ---------------------------------------------------------------------------
/tmp/tmpnhj6t1w6/.env/bin/python: can't open file '/tmp/tmpnhj6t1w6/.env/bin/easy_install': [Errno 2] No such file or directory
_______________________________________________________________ ERROR at setup of test_profile_generates_svg _______________________________________________________________

    @pytest.yield_fixture(scope='session')
    def virtualenv():
        with VirtualEnv() as venv:
            test_dir = resource_filename('pytest_profiling',
                                     'tests/integration/profile')

            # HACK: pin more-itertools to 5.0.0 to keep tests working in PY27 as
            # as that's a py3 only release
>           venv.install_package('more-itertools==5.0.0')

tests/integration/test_profile_integration.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:212: in install_package
    self.run(cmd, capture=False)
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:151: in run
    return super(VirtualEnv, self).run(args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_virtualenv.VirtualEnv object at 0x7f6ff3f579d0>, cmd = '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0'
capture = False, check_rc = True, cd = Path('/tmp/tmpnhj6t1w6'), shell = True
kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_FUNC_which%%': '() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tt...es -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none', ...}}
p = <subprocess.Popen object at 0x7f6ff3f57a30>, out = None, _ = None
err = CalledProcessError(2, '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0')

    def run(self, cmd, capture=False, check_rc=True, cd=None, shell=False, **kwargs):
        """
        Run a command relative to a given directory, defaulting to the workspace root

        Parameters
        ----------
        cmd : `str` or `list`
            Command string or list. Commands given as a string will be run in a subshell.
        capture : `bool`
            Capture and return output
        check_rc : `bool`
            Assert return code is zero
        cd : `str`
            Path to chdir to, defaults to workspace root
        """
        if isinstance(cmd, string_types):
            shell = True
        else:
            # Some of the command components might be path objects or numbers
            cmd = [str(i) for i in cmd]

        if not cd:
            cd = self.workspace

        with cmdline.chdir(cd):
            log.debug("run: {0}".format(cmd))
            if capture:
                p = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs)
            else:
                p = subprocess.Popen(cmd, shell=shell, **kwargs)
            (out, _) = p.communicate()

            if out is not None and not isinstance(out, string_types):
                out = out.decode('utf-8')

            if self.debug and capture:
                log.debug("Stdout/stderr:")
                log.debug(out)

            if check_rc and p.returncode != 0:
                err = subprocess.CalledProcessError(p.returncode, cmd)
                err.output = out
                if capture and not self.debug:
                    log.error("Stdout/stderr:")
                    log.error(out)
>               raise err
E               subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0' returned non-zero exit status 2.

/usr/lib/python3.8/site-packages/pytest_shutil/workspace.py:132: CalledProcessError
_________________________________________________________________ ERROR at setup of test_profile_long_name _________________________________________________________________

    @pytest.yield_fixture(scope='session')
    def virtualenv():
        with VirtualEnv() as venv:
            test_dir = resource_filename('pytest_profiling',
                                     'tests/integration/profile')

            # HACK: pin more-itertools to 5.0.0 to keep tests working in PY27 as
            # as that's a py3 only release
>           venv.install_package('more-itertools==5.0.0')

tests/integration/test_profile_integration.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:212: in install_package
    self.run(cmd, capture=False)
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:151: in run
    return super(VirtualEnv, self).run(args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_virtualenv.VirtualEnv object at 0x7f6ff3f579d0>, cmd = '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0'
capture = False, check_rc = True, cd = Path('/tmp/tmpnhj6t1w6'), shell = True
kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_FUNC_which%%': '() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tt...es -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none', ...}}
p = <subprocess.Popen object at 0x7f6ff3f57a30>, out = None, _ = None
err = CalledProcessError(2, '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0')

    def run(self, cmd, capture=False, check_rc=True, cd=None, shell=False, **kwargs):
        """
        Run a command relative to a given directory, defaulting to the workspace root

        Parameters
        ----------
        cmd : `str` or `list`
            Command string or list. Commands given as a string will be run in a subshell.
        capture : `bool`
            Capture and return output
        check_rc : `bool`
            Assert return code is zero
        cd : `str`
            Path to chdir to, defaults to workspace root
        """
        if isinstance(cmd, string_types):
            shell = True
        else:
            # Some of the command components might be path objects or numbers
            cmd = [str(i) for i in cmd]

        if not cd:
            cd = self.workspace

        with cmdline.chdir(cd):
            log.debug("run: {0}".format(cmd))
            if capture:
                p = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs)
            else:
                p = subprocess.Popen(cmd, shell=shell, **kwargs)
            (out, _) = p.communicate()

            if out is not None and not isinstance(out, string_types):
                out = out.decode('utf-8')

            if self.debug and capture:
                log.debug("Stdout/stderr:")
                log.debug(out)

            if check_rc and p.returncode != 0:
                err = subprocess.CalledProcessError(p.returncode, cmd)
                err.output = out
                if capture and not self.debug:
                    log.error("Stdout/stderr:")
                    log.error(out)
>               raise err
E               subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0' returned non-zero exit status 2.

/usr/lib/python3.8/site-packages/pytest_shutil/workspace.py:132: CalledProcessError
___________________________________________________________________ ERROR at setup of test_profile_chdir ___________________________________________________________________

    @pytest.yield_fixture(scope='session')
    def virtualenv():
        with VirtualEnv() as venv:
            test_dir = resource_filename('pytest_profiling',
                                     'tests/integration/profile')

            # HACK: pin more-itertools to 5.0.0 to keep tests working in PY27 as
            # as that's a py3 only release
>           venv.install_package('more-itertools==5.0.0')

tests/integration/test_profile_integration.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:212: in install_package
    self.run(cmd, capture=False)
/usr/lib/python3.8/site-packages/pytest_virtualenv.py:151: in run
    return super(VirtualEnv, self).run(args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_virtualenv.VirtualEnv object at 0x7f6ff3f579d0>, cmd = '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0'
capture = False, check_rc = True, cd = Path('/tmp/tmpnhj6t1w6'), shell = True
kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_FUNC_which%%': '() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tt...es -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none', ...}}
p = <subprocess.Popen object at 0x7f6ff3f57a30>, out = None, _ = None
err = CalledProcessError(2, '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0')

    def run(self, cmd, capture=False, check_rc=True, cd=None, shell=False, **kwargs):
        """
        Run a command relative to a given directory, defaulting to the workspace root

        Parameters
        ----------
        cmd : `str` or `list`
            Command string or list. Commands given as a string will be run in a subshell.
        capture : `bool`
            Capture and return output
        check_rc : `bool`
            Assert return code is zero
        cd : `str`
            Path to chdir to, defaults to workspace root
        """
        if isinstance(cmd, string_types):
            shell = True
        else:
            # Some of the command components might be path objects or numbers
            cmd = [str(i) for i in cmd]

        if not cd:
            cd = self.workspace

        with cmdline.chdir(cd):
            log.debug("run: {0}".format(cmd))
            if capture:
                p = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs)
            else:
                p = subprocess.Popen(cmd, shell=shell, **kwargs)
            (out, _) = p.communicate()

            if out is not None and not isinstance(out, string_types):
                out = out.decode('utf-8')

            if self.debug and capture:
                log.debug("Stdout/stderr:")
                log.debug(out)

            if check_rc and p.returncode != 0:
                err = subprocess.CalledProcessError(p.returncode, cmd)
                err.output = out
                if capture and not self.debug:
                    log.error("Stdout/stderr:")
                    log.error(out)
>               raise err
E               subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/bin/easy_install -q more-itertools==5.0.0' returned non-zero exit status 2.

/usr/lib/python3.8/site-packages/pytest_shutil/workspace.py:132: CalledProcessError
================================================================================= FAILURES =================================================================================
_______________________________________________________________________________ test session _______________________________________________________________________________

cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f6ffc82d430>, when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>       lambda: ihook(item=item, **kwds), when=when, reraise=reraise
    )

/usr/lib/python3.8/site-packages/_pytest/runner.py:255:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_HookCaller 'pytest_runtest_call'>, args = (), kwargs = {'item': <CheckdocsItem project>}, notincall = set()

    def __call__(self, *args, **kwargs):
        if args:
            raise TypeError("hook calling supports only keyword arguments")
        assert not self.is_historic()
        if self.spec and self.spec.argnames:
            notincall = (
                set(self.spec.argnames) - set(["__multicall__"]) - set(kwargs.keys())
            )
            if notincall:
                warnings.warn(
                    "Argument(s) {} which are declared in the hookspec "
                    "can not be found in this hook call".format(tuple(notincall)),
                    stacklevel=2,
                )
>       return self._hookexec(self, self.get_hookimpls(), kwargs)

/usr/lib/python3.8/site-packages/pluggy/hooks.py:286:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.config.PytestPluginManager object at 0x7f701cbec7c0>, hook = <_HookCaller 'pytest_runtest_call'>
methods = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.8/site-packages/_pytest/runner...pper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>, ...]
kwargs = {'item': <CheckdocsItem project>}

    def _hookexec(self, hook, methods, kwargs):
        # called from all hookcaller instances.
        # enable_tracing will set its own wrapping function at self._inner_hookexec
>       return self._inner_hookexec(hook, methods, kwargs)

/usr/lib/python3.8/site-packages/pluggy/manager.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook = <_HookCaller 'pytest_runtest_call'>
methods = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.8/site-packages/_pytest/runner...pper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>, ...]
kwargs = {'item': <CheckdocsItem project>}

>   self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
        methods,
        kwargs,
        firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
    )

/usr/lib/python3.8/site-packages/pluggy/manager.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook_impls = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.8/site-packages/_pytest/runner...pper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>, ...]
caller_kwargs = {'item': <CheckdocsItem project>}, firstresult = False

    def _multicall(hook_impls, caller_kwargs, firstresult=False):
        """Execute a call into multiple python functions/methods and return the
        result(s).

        ``caller_kwargs`` comes from _HookCaller.__call__().
        """
        __tracebackhide__ = True
        results = []
        excinfo = None
        try:  # run impl and wrapper setup functions in a loop
            teardowns = []
            try:
                for hook_impl in reversed(hook_impls):
                    try:
                        args = [caller_kwargs[argname] for argname in hook_impl.argnames]
                    except KeyError:
                        for argname in hook_impl.argnames:
                            if argname not in caller_kwargs:
                                raise HookCallError(
                                    "hook call must provide argument %r" % (argname,)
                                )

                    if hook_impl.hookwrapper:
                        try:
                            gen = hook_impl.function(*args)
                            next(gen)  # first yield
                            teardowns.append(gen)
                        except StopIteration:
                            _raise_wrapfail(gen, "did not yield")
                    else:
                        res = hook_impl.function(*args)
                        if res is not None:
                            results.append(res)
                            if firstresult:  # halt further impl calls
                                break
            except BaseException:
                excinfo = sys.exc_info()
        finally:
            if firstresult:  # first result hooks return a single value
                outcome = _Result(results[0] if results else None, excinfo)
            else:
                outcome = _Result(results, excinfo)

            # run all wrapper post-yield blocks
            for gen in reversed(teardowns):
                try:
                    gen.send(outcome)
                    _raise_wrapfail(gen, "has second yield")
                except StopIteration:
                    pass

>           return outcome.get_result()

/usr/lib/python3.8/site-packages/pluggy/callers.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pluggy.callers._Result object at 0x7f6ffc86e160>

    def get_result(self):
        """Get the result(s) for this hook call.

        If the hook was marked as a ``firstresult`` only a single value
        will be returned otherwise a list of results.
        """
        __tracebackhide__ = True
        if self._excinfo is None:
            return self._result
        else:
            ex = self._excinfo
            if _py3:
>               raise ex[1].with_traceback(ex[2])

/usr/lib/python3.8/site-packages/pluggy/callers.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hook_impls = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.8/site-packages/_pytest/runner...pper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>, ...]
caller_kwargs = {'item': <CheckdocsItem project>}, firstresult = False

    def _multicall(hook_impls, caller_kwargs, firstresult=False):
        """Execute a call into multiple python functions/methods and return the
        result(s).

        ``caller_kwargs`` comes from _HookCaller.__call__().
        """
        __tracebackhide__ = True
        results = []
        excinfo = None
        try:  # run impl and wrapper setup functions in a loop
            teardowns = []
            try:
                for hook_impl in reversed(hook_impls):
                    try:
                        args = [caller_kwargs[argname] for argname in hook_impl.argnames]
                    except KeyError:
                        for argname in hook_impl.argnames:
                            if argname not in caller_kwargs:
                                raise HookCallError(
                                    "hook call must provide argument %r" % (argname,)
                                )

                    if hook_impl.hookwrapper:
                        try:
                            gen = hook_impl.function(*args)
                            next(gen)  # first yield
                            teardowns.append(gen)
                        except StopIteration:
                            _raise_wrapfail(gen, "did not yield")
                    else:
>                       res = hook_impl.function(*args)

/usr/lib/python3.8/site-packages/pluggy/callers.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <CheckdocsItem project>

    def pytest_runtest_call(item: Item) -> None:
        _update_current_test_var(item, "call")
        try:
            del sys.last_type
            del sys.last_value
            del sys.last_traceback
        except AttributeError:
            pass
        try:
            item.runtest()
        except Exception as e:
            # Store trace info to allow postmortem debugging
            sys.last_type = type(e)
            sys.last_value = e
            assert e.__traceback__ is not None
            # Skip *this* frame
            sys.last_traceback = e.__traceback__.tb_next
>           raise e

/usr/lib/python3.8/site-packages/_pytest/runner.py:170:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

item = <CheckdocsItem project>

    def pytest_runtest_call(item: Item) -> None:
        _update_current_test_var(item, "call")
        try:
            del sys.last_type
            del sys.last_value
            del sys.last_traceback
        except AttributeError:
            pass
        try:
>           item.runtest()

/usr/lib/python3.8/site-packages/_pytest/runner.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CheckdocsItem project>

    def runtest(self):
        desc = self.get_long_description()
        method_name = f"run_{re.sub('[-/]', '_', desc.content_type)}"
>       getattr(self, method_name)(desc)

/usr/lib/python3.8/site-packages/pytest_checkdocs/__init__.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CheckdocsItem project>
desc = '# Pytest Profiling Plugin\n\nProfiling plugin for pytest, with tabular and heat graph output.\n\nTests are profiled w...args\n\n### 1.0.1 (2015-12-23)\n\n *  Packaging bugfix\n\n### 1.0.0 (2015-12-21)\n\n *  Initial public release\n\n\n\n'

    def run_text_x_rst(self, desc):
        with self.monkey_patch_system_message() as reports:
            self.rst2html(desc)
>       assert not reports
E       AssertionError: assert not ['Unexpected indentation.', 'Inline literal start-string without end-string.', 'Inline interpreted text or phrase refe...start-string without end-string.', 'Inline interpreted text or phrase reference start-string without end-string.', ...]

/usr/lib/python3.8/site-packages/pytest_checkdocs/__init__.py:50: AssertionError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
<string>:15: (ERROR/3) Unexpected indentation.
<string>:13: (WARNING/2) Inline literal start-string without end-string.
<string>:13: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:18: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<string>:18: (WARNING/2) Inline literal start-string without end-string.
<string>:18: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:22: (WARNING/2) Inline literal start-string without end-string.
<string>:22: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:24: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
<string>:24: (WARNING/2) Inline literal start-string without end-string.
<string>:24: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:35: (WARNING/2) Inline literal start-string without end-string.
<string>:35: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:33: (ERROR/3) Unexpected indentation.
<string>:37: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
<string>:37: (WARNING/2) Inline literal start-string without end-string.
<string>:37: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:79: (WARNING/2) Inline literal start-string without end-string.
<string>:79: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:59: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<string>:70: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
<string>:81: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
<string>:81: (WARNING/2) Inline literal start-string without end-string.
<string>:81: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:89: (WARNING/2) Inline literal start-string without end-string.
<string>:89: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:91: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
<string>:91: (WARNING/2) Inline literal start-string without end-string.
<string>:91: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:99: (WARNING/2) Inline literal start-string without end-string.
<string>:99: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:101: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
<string>:101: (WARNING/2) Inline literal start-string without end-string.
<string>:101: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:107: (WARNING/2) Inline literal start-string without end-string.
<string>:107: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:109: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
<string>:109: (WARNING/2) Inline literal start-string without end-string.
<string>:109: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
<string>:127: (WARNING/2) Inline emphasis start-string without end-string.
============================================================================= warnings summary =============================================================================
tests/integration/test_profile_integration.py:9
  /home/tkloczko/rpmbuild/BUILD/pytest-profiling-1.7.0/tests/integration/test_profile_integration.py:9: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
  Use @pytest.fixture instead; they are the same.
    @pytest.yield_fixture(scope='session')

../../BUILDROOT/python-pytest-profiling-1.7.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_profiling.py:20
  /home/tkloczko/rpmbuild/BUILDROOT/python-pytest-profiling-1.7.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_profiling.py:20: DeprecationWarning: invalid escape sequence \:
    forbidden_chars = set('/?<>\:*|"')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
ERROR tests/integration/test_profile_integration.py::test_profile_profiles_tests - subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t...
ERROR tests/integration/test_profile_integration.py::test_profile_generates_svg - subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1...
ERROR tests/integration/test_profile_integration.py::test_profile_long_name - subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/....
ERROR tests/integration/test_profile_integration.py::test_profile_chdir - subprocess.CalledProcessError: Command '/tmp/tmpnhj6t1w6/.env/bin/python /tmp/tmpnhj6t1w6/.env/...
FAILED ::project - AssertionError: assert not ['Unexpected indentation.', 'Inline literal start-string without end-string.', 'Inline interpreted text or phrase refe...st...
============================================================ 1 failed, 8 passed, 2 warnings, 4 errors in 7.23s =============================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SteveHespeltcommented, Apr 7, 2022

Hi Tomas, I’ve got some local changes to the pytest-profiling plugin (my recent fork.) The changes add a number of options for controlling the use of the pstats.Stats methods, options for providing the ordered list of restrictions. And options to pass through gprof2dot options.

I’ve added unit & integration tests for these changes as well. We’ve been using the changes (1.7.2?) for several weeks now with no issues encountered.

I’ll submit the PR either today or tomorrow. -Steve Hespelt

From: Tomasz Kłoczko @.> Sent: Thursday, April 7, 2022 7:41 AM To: man-group/pytest-plugins @.> Cc: Steven Hespelt @.>; Comment @.> Subject: Re: [man-group/pytest-plugins] pytest-profiling 1.7.0: pytest is failing (#185)

CAUTION: This email originated from outside the organization. Please do not click links or open attachments unless you recognize the sender and know the content is safe.

Any chance to make new release of those modules? Last one was in 2019 …

Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fman-group%2Fpytest-plugins%2Fissues%2F185%23issuecomment-1091632118&data=04|01|shespelt%40stevens.edu|e14eaf809c904999625c08da188b8427|8d1a69ec03b54345ae21dad112f5fb4f|0|0|637849284753690618|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=Kc8srbUnkfaJJggyb6xWU%2BPq5b6uSQ78j1sDWfFKjG8%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJ6EXXF5RJT7QR7IF5WIGW3VD3CVPANCNFSM5B2YVYZQ&data=04|01|shespelt%40stevens.edu|e14eaf809c904999625c08da188b8427|8d1a69ec03b54345ae21dad112f5fb4f|0|0|637849284753690618|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=SHf26yI2BoAl858wuGQhwrlXoLWn01IvWcIy8SDbjyA%3D&reserved=0. You are receiving this because you commented.Message ID: @.@.>>

0reactions
SteveHespeltcommented, Apr 10, 2022

Hi Tomas, Sorry for the delay, probably a few more days – I’ve been ill the past 4-5 days. Turns out, I’m not that special after all… As soon as I can trust my brain for more than a few minutes, I’ll add the PR. -Steve

From: Tomasz Kłoczko @.> Sent: Saturday, April 9, 2022 10:32 AM To: man-group/pytest-plugins @.> Cc: Steven Hespelt @.>; Comment @.> Subject: Re: [man-group/pytest-plugins] pytest-profiling 1.7.0: pytest is failing (#185)

CAUTION: This email originated from outside the organization. Please do not click links or open attachments unless you recognize the sender and know the content is safe.

OK … please let me know when tose PRs will be added. I’ll be glad to help test that 😄

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fman-group%2Fpytest-plugins%2Fissues%2F185%23issuecomment-1094044146&data=04|01|shespelt%40stevens.edu|8b7fb9ec847b49e6f6e008da1a35b928|8d1a69ec03b54345ae21dad112f5fb4f|0|0|637851115305698886|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=txlFu8xqVzJq00W6v0cXvjaebMAkTD%2BhAKC8GVeqAQk%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJ6EXXBBOCKQMUMAU6IZSB3VEGIGNANCNFSM5B2YVYZQ&data=04|01|shespelt%40stevens.edu|8b7fb9ec847b49e6f6e008da1a35b928|8d1a69ec03b54345ae21dad112f5fb4f|0|0|637851115305698886|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000&sdata=CvPBxwGbV0wj6sJtuKmi4Rp8iOdAFcQg4krdjJxIytE%3D&reserved=0. You are receiving this because you commented.Message ID: @.@.>>

Read more comments on GitHub >

github_iconTop Results From Across the Web

8.7.0: pytest is failing · Issue #1463 · joke2k/faker - GitHub
I just tested 10.0.0 and pytest still is failing with exactly the same message that it cannot find tests module (which seems is...
Read more >
pytest-devpi-server - PyPI
DevPi server fixture for py.test. The server is session-scoped by default and run in a subprocess and temp dir to cleanup when it's...
Read more >
py.test 2.2.0: test marking++, parametrization++ ...
py.test 2.2.0: test marking++, parametrization++ and duration profiling¶ ... pytest-2.2.0 is a test-suite compatible release of the popular py.test testing tool.
Read more >
Basic patterns and examples — pytest documentation
content of conftest.py import pytest def pytest_addoption(parser): ... from a test you can use the pytest.fail marker to fail a test with a...
Read more >
pytest-steps
Manual execution of tests has slightly changed in 1.7.0 , see explanations here. New 'generator' style is there, check it out ! New...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found