A pytest plugin to trace resource leaks.
Project description
A pytest plugin to trace resource leaks.
Usage
To add a leaks test to your py.test session, add the -R option on the command line:
$ py.test -v -R : test_fauset.py ============================= test session starts ============================= platform darwin -- Python 3.5.2+, pytest-3.0.5.dev0, py-1.4.31, pluggy-0.4.0 -- cachedir: .cache rootdir: .../abalkin/pytest-leaks, inifile: plugins: leaks-0.2.0, cov-2.4.0, pyq-1.1 collected 3 items test_fauset.py::test_leaky_fauset LEAKED test_fauset.py::test_broken_fauset FAILED test_fauset.py::test_mended_fauset PASSED ================================ leaks summary ================================ test_fauset.py::test_leaky_fauset: Leaks([('refs', [2, 2, 2, 2])]) ================================== FAILURES =================================== _____________________________ test_broken_fauset ______________________________ def test_broken_fauset(): > assert 0 E assert 0 test_fauset.py:6: AssertionError ================ 1 failed, 1 passed, 1 leaked in 0.46 seconds =================
The test file used above contains the following code:
$ cat test_fauset.py drops = [] def test_leaky_fauset(): drops.append({}) def test_broken_fauset(): assert 0 def test_mended_fauset(): assert 1
Features
Detects memory leaks by running py.test tests repeatedly and comparing total reference counts between the runs.
Requirements
py.test version >= TBD;
A debug build of Python 3.5.
Installation
You can install “pytest-leaks” via pip from PyPI:
$ pip install pytest-leaks
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the MIT license, “pytest-leaks” is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Acknowledgements
This Pytest plugin was initially generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-leaks-0.2.2.tar.gz
.
File metadata
- Download URL: pytest-leaks-0.2.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c38a82f7740443d65098cf9df3dd0412494981ca7746a833ee193cdfb4e53326 |
|
MD5 | 8df8592ecd8a19da80e19de2fc5faa67 |
|
BLAKE2b-256 | ee3747ee85fe04c3fb0da64fab785752e98cb7568ff6197d474b315294ec3ea6 |
Provenance
File details
Details for the file pytest_leaks-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: pytest_leaks-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b18538dd5a31a886f2265c760e2fb6fcf8ee5ffab4358c555541bc6b79ed4c74 |
|
MD5 | 62b2bfdd70d1cf6df453f755481c80dd |
|
BLAKE2b-256 | a0a4aee9163f07f8183131259b7f652a1fe55ae54f9a817353dd261c19c726c3 |