Skip to main content

pytest db plugin

What

  • uploading test stdout & stderr to a DB

Why

  • keeping all stdout & stderr ready in a DB for easy debugging and comparison

How

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

Installtion

  • for default db client: pip install pytest-db
  • for es db client: pip install pytest-db[es]
Hosting
  • the package will be hosted on global pypi

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 additionalizing:
    1. DB url and authentication
    2. DB interaction failure should fail test [default: false]
    3. sources to upload [default: stdout, stderr]
  • toml format
type = <type>
url = <url>
index = <index>
must-upload = false

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

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.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_db_plugin-0.0.0.0.0.1-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.1.tar.gz.

File metadata

  • Download URL: pytest-db-plugin-0.0.0.0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7021ba681ccc968919085fbd02b409d078fa5a4bc446bc707c1b388e9e669bbf
MD5 3108634b0b88b0f4068fa1b52bf3d158
BLAKE2b-256 bf60aae30805ba3cd6d7c4c7b655c8f53b43f2f8df2cc7bfbdeac9c1b4b395be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_db_plugin-0.0.0.0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eeb20b4d83ac2514f8c80bd840526f782443c2e080fd11b919d6e43d76832caf
MD5 155ff6a2bf9a4aa8f871b5ca981040ed
BLAKE2b-256 4276bc337547103392c26050735d2c9f3936e873e000210dafd3db16f4f86611

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page