
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
pytest plugin that allows to dump environment variables, package version and generic attributes
Print environment variables, package version and generic attributes, as they are at the beginning of the test.
Useful in the continuous integration to dump test
configuration/environment and or to check if attributes are properly set
(ie. you change environment with os.environ
)
install via::
pip install pytest-echo
$ pytest --echo-env=HOME
============================= test session starts =========================
platform linux2 -- Python 2.7.4 -- py-1.4.22 -- pytest-2.6.0 -- /bin/python
Environment:
HOME: /Users/sax
plugins: echo, pydev, cov, cache, django
$ pytest --echo-version=pytest_echo
============================= test session starts =========================
platform linux2 -- Python 2.7.4 -- py-1.4.22 -- pytest-2.6.0 -- /bin/python
Package version:
pytest_echo: 0.1
plugins: echo, pydev, cov, cache, django
[!NOTE] The first attempt to retrieve the version is done via setuptools if it fails, the module is imported (
__import__(package)
) to retrieve the version readingget_version
,__version__
,VERSION
,version
so any module level code is executed. This should be not an issue as no problematic code should be present in the first level of the package
$ pytest --echo-attr=django.conf.settings.DEBUG
============================= test session starts =========================
platform linux2 -- Python 2.7.4 -- py-1.4.22 -- pytest-2.6.0 -- /bin/python
Inspections
django.conf.settings.DEBUG: False
plugins: echo, pydev, cov, cache, django
[!NOTE] Be careful when use
--echo-attr
. It loads any module in the path and this will execute any module level code If you try to dump a property, relatedgetter
will be executed.
[!NOTE] You cannot dump callable result.
Example of use in a django project:
[pytest]
addopts = -vvv
--tb=short
--capture=no
--echo-env PWD
--echo-env VIRTUAL_ENV
--echo-env DBENGINE
--echo-version django
--echo-version pip
--echo-version pytest-echo
--echo-attr django.conf.settings.DATABASES.default.ENGINE
$ pytest
============================= test session starts =========================
platform linux2 -- Python 2.7.4 -- py-1.4.22 -- pytest-2.6.0 -- /bin/python
Environment:
DJANGO_SETTINGS_MODULE: tests.settings
PWD: /data/PROGETTI/sem
VIRTUAL_ENV: /data/VENV/sem
DBENGINE: <not set>
Package version:
django: 1.6.5
pip: 1.5.6
pytest_echo: 1.2
Inspections:
django.conf.settings.DATABASES.default.ENGINE: 'django.db.backends.postgresql_psycopg2'
plugins: echo, cache, capturelog, contextfixture, cov, django, pydev
collected 14 items
.............
14 passed in 4.95 seconds
Starting from version 1.5, is possible to glob packages version and environment variables, as:
$ pytest --echo-version=pytest-* --echo-env=VIRTUAL*
or
[pytest]
addopts = -vvv
--echo-env VIRTUAL*
--echo-version pytest-*
FAQs
pytest plugin that allows to dump environment variables, package version and generic attributes
We found that pytest-echo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.