Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest-profiling 1.7.0: pytest is failing #185

Open
kloczek opened this issue Aug 9, 2021 · 8 comments
Open

pytest-profiling 1.7.0: pytest is failing #185

kloczek opened this issue Aug 9, 2021 · 8 comments

Comments

@kloczek
Copy link

kloczek commented Aug 9, 2021

I'm trying to package your module as rpm package. 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()'.
@eeaston
Copy link
Collaborator

eeaston commented Nov 19, 2021

Hi there, this looks like an issue with python2 compatibility which we will shortly be dropping - I'll let you know when it's released and you can check again if it's still a problem.

@kloczek
Copy link
Author

kloczek commented Dec 31, 2021

Other thing was pinning more-itertools version solved in 6e2d3e5.
I think that it would be good to make new release of the pytest plugins because currently many known issues already have been resolved and merged to the git repo.

aflag added a commit that referenced this issue Jan 28, 2022
@SteveHespelt
Copy link

I was making some changes to the pytest-profiling plugin & ran into this issue too. It's because, per the setuptools' v52.0 change, the easy_install entrypoint is no longer installed. I started making serious changes to pytest-virtualenv before I realized a potential hack might be available. Sure enough, if I change the pkg_name arguments of the test_profile_intergration.py's usage of VirtualEnv.install_package() to use 'install ' as a prefix, specify installer='pip' rather than the default 'easy_install', then the install_package will successfully install requested packages need by the tests. That is,

venv.install_package("install more-itertools", installer='pip')
...
venv.install_package("install 'pytest-profiling>1.7.1' ", installer='pip' ) # <- my locally built 1.7.2, uploaded wheel 

For my locally developed profiling wheel, I built the wheel, uploaded to a devpi index, then prior to running the integration tests, defined PIP_EXTRA_INDEX_URL to point the test process to that index. It works with pytest-virtualenv 1.7.0. Lucky hack. And it, of course, forces every requested package to be installed from an index, bypassing the develop mode installs. That's why I had to use the local devpi index.

@kloczek
Copy link
Author

kloczek commented Apr 7, 2022

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

@SteveHespelt
Copy link

SteveHespelt commented Apr 7, 2022 via email

@kloczek
Copy link
Author

kloczek commented Apr 9, 2022

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

@SteveHespelt
Copy link

SteveHespelt commented Apr 10, 2022 via email

@kloczek
Copy link
Author

kloczek commented Jul 5, 2023

Gentle ping .. any update? 😋
Looking on v1.7.0...master I see 100 commits since last release which was in 2019.
Any plans to release new version?🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants