
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Capture and show logbook logging output during test runs.
This pytest_ plugin provides will capture log messages emitted by logbook and display them in their own section in the test report if the test fails. Additionally it provides a fixture which provides easy access to the log records emitted during the test which allows making assertions on emitted log message. The plugin also sets up logging redirection from the stdlib to go via logbook so any libraries which use stdlib logging will also be captured.
.. _pytest: http://pytest.org
Install using pip::
pip install pytest-logbook
Log capturing happens automatically once installed, including stdlib logging redirection::
def test_foo(): logbook.info('hello') logging.info('world') assert 0
::
$ py.test test_foo.py =========================== test session starts ============================ platform linux -- Python 3.4.3, pytest-2.8.2, py-1.4.30, pluggy-0.3.1 rootdir: /home/flub/Abilisoft/repos/pytest-logbook, inifile: plugins: logbook-0.1.0 collected 1 items
test_foo.py F
================================= FAILURES ================================= _________________________________ test_foo _________________________________
def test_foo():
logbook.info('hello')
logging.info('world')
assert 0
E assert 0
test_foo.py:7: AssertionError --------------------------- Logbook call records --------------------------- [INFO] Generic: hello [INFO] root: world ========================= 1 failed in 0.01 seconds =========================
Logs messages emitted during test setup and teardown are also captured individually. If setup fails you will see them in a "Logbook setup records" section and if teardown fails you will see the teardown log messages in a "Logbook teardown records" section.
Several fixtures are provided to access the captured log records.
loghandler
Access the logbook.TestHandler
instance active during the test
run. You can use it to inspect the emitted log records, see the
full documentation
_ for details on how to use this object. Only
log records emitted during the actual test are recorded here,
records emitted during test setup or teardown are recorded in the
other fixtures.
.. _full documentation: http://pythonhosted.org//Logbook/api/handlers.html#logbook.TestHandler
loghandler_setup
Access the logbook.TestHandler
instance active during the test
setup.
loghandler_teardown
Access the logbook.TestHandler
instance active during the test
teardown.
The plugin can be configured using options in the py.test configuration file
_ in the standard [pytest]
section.
.. _py.test configuration file: http://pytest.org/latest/customize.html#initialization-determining-rootdir-and-inifile
logbook_stdlib
This configures whether the stdlib logging is redirected to
logbook. Set it to either true
(default) or false
.
logging.compat
module
accessible.LICENSE
.MANIFEST.in
in ship LICENSE, tox.ini and test module.FAQs
py.test plugin to capture logbook log messages
We found that pytest-logbook demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.