pytest plugin with mechanisms for echoing environment variables, package version and generic attributes
Project description
Print environment variables, package version and generic attributes, as they are at the begining of the test.
Useful in the continuous integration to dump test configuration/environment and or to check is attributes are properly set (ie. you change environment with os.environ)
Install
install via:
pip install pytest-echo
The plugin provides ability to print some extra information prior to run the tests.
Examples
Dump environment variables
$ py.test --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
Dump package version
$ py.test --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
Dump attributes
$ py.test --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
Configure via tox.ini/setup.cfg/pytest.cfg
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
$ py.test
============================= 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
Globbing
Starting from version 1.5, is possible to glob packages version and environment variables, as:
$ py.test --echo-version=pytest-* --echo-env=VIRTUAL*
or
[pytest]
addopts = -vvv
--echo-env VIRTUAL*
--echo-version pytest-*
Links
Stable |
|||
Development |
|||
Project home page: |
|||
Issue tracker: |
|||
CI: |
|||
Download: |
|||
Documentation: |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pytest-echo-1.5.1.tar.gz
.
File metadata
- Download URL: pytest-echo-1.5.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5eb4c9048bcaa3b00bc3796ed62ffeeba81d6f854bd78fbe4a064ab6e6952e9 |
|
MD5 | 9fc284b3c304a4060986e39c12826edf |
|
BLAKE2b-256 | c6636351cd204aac2e4820ab086f707ee43e1cb488c4102a0a5accab268fef5b |