Skip to main content

No project description provided

Project description

Vedro

Codecov PyPI PyPI - Downloads Python Version

(!) Work in progress, breaking changes are possible until v2.0 is released

Installation

$ pip3 install vedro

Usage

# ./scenarios/decode_base64_encoded_string.py
from aiohttp import ClientSession
import vedro

class Scenario(vedro.Scenario):
    subject = "decode base64 encoded string"

    def given(self):
        self.encoded = "YmFuYW5h"

    async def when(self):
        async with ClientSession() as session:
            self.response = await session.get(f"https://httpbin.org/base64/{self.encoded}")

    async def then(self):
        assert (await self.response.text()) == "banana"
$ python3 -m vedro .

Documentation


Selecting Scenarios

Select File or Directory

$ python3 -m vedro <file_or_dir>

Skip File or Directory

$ python3 -m vedro -i (--ignore) <file_or_dir>

Select Specific Scenario

import vedro

@vedro.only
class Scenario(vedro.Scenario):
    subject = "register user"

Skip Specific Scenario

import vedro

@vedro.skip
class Scenario(vedro.Scenario):
    subject = "register user"

Reporters

Rich Reporter (default)

$ python3 -m vedro -r rich -vvv

Verbose Levels

Verbose Show Scenario Show Steps Show Exception Show Scope (scenario variables)
-v
-vv
-vvv

Silent Reporter

$ python3 -m vedro -r silent

Parametrized Scenario

from aiohttp import ClientSession
import vedro
from vedro import params

class Scenario(vedro.Scenario):
    subject = "get status ({status})"

    @params(200)
    @params(404)
    def __init__(self, status: int):
        self.status = status

    def given(self):
        self.url = f"https://httpbin.org/status/{self.status}"

    async def when(self):
        async with ClientSession() as session:
            self.response = await session.get(self.url)

    async def then(self):
        assert self.response.status == self.status

Plugins

Register Plugin

# ./bootstrap.py
import vedro
from vedro import Dispatcher
from vedro.plugins import Plugin


class DoNothing(Plugin):
    def subscribe(self, dispatcher: Dispatcher) -> None:
        pass


vedro.run(plugins=[DoNothing()])
$ python3 bootstrap.py

Available Plugins

Core

Reporters

And more..

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

vedro-1.2.2.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

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

vedro-1.2.2-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

Details for the file vedro-1.2.2.tar.gz.

File metadata

  • Download URL: vedro-1.2.2.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for vedro-1.2.2.tar.gz
Algorithm Hash digest
SHA256 e37ca5b206f5b6a4ba1469bd70a85ecb5cdb36ea4ef2ec6ac8e0a6d2eda334da
MD5 bd696eacb391d574bffcf4f9692f3518
BLAKE2b-256 559f2730fe59c68b326baa25efe831453535e859b5a192fd489ecdf9c15b4ee9

See more details on using hashes here.

File details

Details for the file vedro-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: vedro-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 59.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for vedro-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0cf513bb9def394b9f2beef4b8e2421d107db1ba561c66ffec9145184968404
MD5 cb02e7c22b4ba4b1ee8f546ff3faf24e
BLAKE2b-256 10e0c7944833a0958af5ddf820e17744d5bc8ce4cee28c8e78e0875b7b9252e5

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 Pingdom Monitoring Sentry Error logging StatusPage Status page