bloomberg / pytest-pystack Goto Github PK
View Code? Open in Web Editor NEWPytest plugin that runs PyStack on slow or hanging tests.
License: Apache License 2.0
Pytest plugin that runs PyStack on slow or hanging tests.
License: Apache License 2.0
Is your feature request related to a problem? Please describe.
Option to set parameters to pystack in ini file (tool.pytest.ini_options
section in pyproject.toml
) is really nice. But pytest-pystack
currently could be installed only on linux. So if a project is designed to work on multiple operating systems, then configuring pytest-pystack
this way collides with --strict-config
It will be nice to be able to use strict config and configure pytest-pystack
in file at the same time.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Add option to configure pytest-pystack using own section in pyproject.toml
Describe alternatives you've considered
Play with conditional test configuration in tox/nox file.
Users might get the following error in CI:
๐ Engine error: No such process ๐
The specified process cannot be traced. This could be because the tracer
has insufficient privileges (the required capability is CAP_SYS_PTRACE).
Unprivileged processes cannot trace processes that they cannot send signals
to or those running set-user-ID/set-group-ID programs, for security reasons.
Alternatively, the process may already be being traced.
If your uid matches the uid of the target process you want to analyze, you
can do one of the following to get 'ptrace' scope permissions:
* If you are running inside a Docker container, you need to make sure you
start the container using the '--cap-add=SYS_PTRACE' or '--privileged'
command line arguments. Notice that this may not be enough if you are not
running as 'root' inside the Docker container as you may need to disable
hardening (see next points).
* Try running again with elevated permissions by running 'sudo -E !!'.
* You can disable kernel hardening for the current session temporarily (until
a reboot happens) by running 'echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope'.
Rather than waiting for them to get the error to notice it, document that when running in github actions they should have a step that runs echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
.
We can add this in a section of the README file.
Describe the bug
Pytest provides pytester
fixture to allow to validate if fixtures provided by a package works correctly:
https://docs.pytest.org/en/7.1.x/reference/reference.html?highlight=pytester#pytester
However, this leads to run test in test and leads pytest-pystack
to crash.
Process pystack_monitor:
Traceback (most recent call last):
File "/home/czaki/.pyenv/versions/3.11.5/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/home/czaki/.pyenv/versions/3.11.5/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/czaki/.pyenv/versions/napari_3.11/lib/python3.11/site-packages/pytest_pystack/_monitor_process.py", line 57, in _run_monitor
raise Exception(
Exception: new test should not start before previous test finished
This stacktrace comes from https://github.com/napari/napari/blob/cb7f46dfe0100c3afdd622faca768bc393b19636/napari/_tests/test_pytest_plugin.py
To Reproduce
Steps to reproduce the behavior:
pytester
fixture to run testsExpected behavior
Allow use pytester
with pytest-pystack
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Document differences with the built-in pytest-faulthandler
plugin, explaining how pytest-pystack can provide more data via locals, native code and configuration options.
Exception ignored in atexit callback: <function _stop at 0x7fcf97f30000>
Traceback (most recent call last):
File "/usr/lib64/python3.12/site-packages/pytest_pystack/_monitor_process.py", line 73, in _stop
queue.put(None)
File "/usr/lib64/python3.12/multiprocessing/queues.py", line 94, in put
self._start_thread()
File "/usr/lib64/python3.12/multiprocessing/queues.py", line 177, in _start_thread
self._thread.start()
File "/usr/lib64/python3.12/threading.py", line 971, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
No errors.
Run test suite with pytest-pystack==1.0.0
and pystack_args="--native --locals"
.
1.3.0
3.12
Fedora
pytest 7.4.3
pytest-xdist 3.5.0
Can not really provide any project specific details, just tried to update to Python 3.12 and got the errors.
Similar to pytest-faulthandler, run pystack if the process crashes but including both C++ and Python code (and optionally variables).
Hide pytest stack frames by default as they are often just noise to the users trying to debug a problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.