Skip to main content

A simple plugin to use with pytest

Project description

pytest-inline is a plugin for pytest that writes inline tests.

Installation and usage

Use pip install pytest-inline to install our Python pytest-plugin

Use pytest . to run all inline tests in working directory

Use pytest {filename} to run all inline tests in a Python file

API

Declaration an inline test

  • Here(test_name, parameterized, repeated, tag, disabled, timeout):
    1. test_name is a string that represents the name of the test. The default value is the file name + line number of the test statement.

    2. parameterized is a boolean value that indicates whether the test is parameterized. The default value is false.

    3. repeated is an integer that indicates how many times the test is repeated. The default value is 1.

    4. tag is a string that represents the tag of the test. The default value is an empty string.

    5. disabled is a boolean value that indicates whether the test is disabled. The default value is false.

    6. timeout is an integer that represents the timeout of the test. The default value is -1.

Provide test inputs

  • given(variable, value):

    assign the value to the variable.

Specify test oracles

  • check_eq(actual_value, expected_value):

    check if the actual value is equal to the expected value.

  • check_neq(actual_value, expected_value):

    check if the actual value is not equal to the expected value.

  • check_true(expr):

    check if the boolean expression is true.

  • check_false(expr):

    check if the boolean expression is false.

  • check_none(variable):

    check if the variable is none.

  • check_not_none(variable):

    check if the variable is not none.

  • check_same(actual_value, expected_value):

    check if the actual value and the expected value refer to the same object.

  • check_not_same(actual_value, expected_value):

    check if the actual value and the expected value refer to different objects.

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-inline-1.0.0.tar.gz (21.7 kB view hashes)

Uploaded Source

Built Distribution

pytest_inline-1.0.0-py3-none-any.whl (21.2 kB view hashes)

Uploaded Python 3

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