Skip to main content

No project description provided

Project description

pytest db plugin

uploading test stdout & stderr to a DB for easy debugging and comparison

Installtion

  • for es db client: pip install pytest-db[es]
  • for only default (local files) db client: pip install pytest-db

Flow

  1. pytest test ends
  2. pytest test teardown starts
  3. plugin starts
  4. plugin connects to DB
  5. plugin collects all sources
  6. plugin uploads all sources
  7. plugin ends DB connection
  8. plugin ends

Invocation

  • pytest ...
    • as long as the plugin is installed, and the url is provided, the plugin will attempt to upload
    • if the plugin is installed but a config file is not present / malformed / missing url, a warning will be displayed in the end of the test

Configuration

  • minimal
  • optional
    • not having one will not break the test
    • not having one will mean nothing is uploaded UNLESS the url param is passed in the invocation command
      • a default db client will be used in such cases and the data will be written into "/tmp"
  • will be located in invocation directory
  • name: ".config.toml"
  • allows for customizing:
    1. DB url and authentication
    2. DB interaction failure should fail test [default: false]
  • toml format (see example)
  • see supported dbs

Compitability

Supported DB

  • local file system (local)
  • Elasticsearch (es)

Additional data

  • each upload can include additional keys and values
  • the key will be defined in the config file
  • the value will be defined as a either
    • const
    • function that will be invoked in after collecting the doc
    • supported function languages:
      • bash
      • python
    • config file example:
...
[additional-data]
[additional-data.consts]
name = 'my-name'

[additional-data.bash]
os = 'lsb_release -sr'

[additional-data.python]
current directory = 'import os; print(os.getcwd())' 
  • python functions will be called using exec
  • bash functions will be called using subprocess.check_output

Config File Example

ES
# optional
title = 'my pytest db plugin config'
user = 'avin'

# required
type = 'es'
url = 'my-url'
index = 'my-index'

# optional
must-upload = true

[additional-data]
    [additional-data.consts]
    name = 'avin'

    [additional-data.bash]
    os = 'lsb_release -sr'

    [additional-data.python]
    current directory = 'import os; print(os.getcwd())' 

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

pytest-db-plugin-0.0.0.0.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

pytest_db_plugin-0.0.0.0.0.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest-db-plugin-0.0.0.0.0.2.tar.gz.

File metadata

  • Download URL: pytest-db-plugin-0.0.0.0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for pytest-db-plugin-0.0.0.0.0.2.tar.gz
Algorithm Hash digest
SHA256 7dc453741ccbe809f2767c569f8306785a54d127820268ad902f950e8363a960
MD5 34eebdaf981a965db73f67ce97ab41a2
BLAKE2b-256 ad87ce81064bb509720f9a84d90675f4b3b5ea8da75858328f69973c9a050367

See more details on using hashes here.

File details

Details for the file pytest_db_plugin-0.0.0.0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pytest_db_plugin-0.0.0.0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for pytest_db_plugin-0.0.0.0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71c4af0b72a546db3acafea4b42b28fcd737f4c35bbe1a67e8ec2377d1e0309a
MD5 91797ee15d9900b99f84eee66987440c
BLAKE2b-256 4de516b24016295c7aaca53059f56f07b2c4ffa35153974ad0b6ae1813eed63d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page