Python test step

The Python test step executes arbitrary Python code using the set Python version. Python version 3.10 is supported. The maximum length of the script is 10240 characters.

The step fails if the script execution fails or if it ends with a non-zero exit code. The content of the standard output and standard error is recorded as the result of the test step and can be viewed using the Wenenu UI or accessed using the Wenenu API. The maximum combined length of the standard output and error is 524288 characters. The output is truncated if it exceeds the maximum length.

Note The variables of the test scenario are available as environment variables during the execution.
Note Filesystem operations are available. Every test step runs in separate docker containers. Test steps in the same test scenario have a common directory mounted into the container, sharing files between test steps is possible. The mounted directory is under /tests which is the current directory when the test execution starts.
Warning For security reasons, do not display any sensitive information in the step result.

UI settings

Python step UI settings
Figure 1. Python step UI settings

1

Arbitrary name of the test step up to 64 characters

2

Test agent that is going to execute the test step

3

Version of Python that executes the code

4

Arbitrary Python code that gets executed

JSON

{
  "displayName": "Python v3.8 test", 1
  "type": "python", 2
  "id": "46bf861c-141e-49bc-9a89-f5751dd21183", 3
  "version": "3.8.x", 4
  "code": "import sys\nimport os\nimport pip\n\nprint(sys.version + \"\\n\");\nprint(\"Hello world\\n\");\nprint(os.getcwd() + \"\\n\");\nhelp(\"modules\");", 5
  "agent": { 6
    "type": "standard",
    "id": "162dff466f92c372005cf7055d006b77ac377e01c60ae59f942d74680f2496d1"
  }
}
1 Arbitrary name of the test step up to 64 characters
2 Type of the test step, must be 'python'
3 Version 4 unique identifier of the test step, must be unique within the test scenario
4 Version of Python that executes the code
5 Arbitrary Python code that gets executed
6 Agent object defining the agent that will execute the test step

Available modules, commands and libraries

Python 3.8.5

Name Type Version

appdirs

package

1.4.4

attrs

package

20.2.0

certifi

package

2020.6.20

cffi

package

1.14.2

chardet

package

3.0.4

click

package

7.1.2

cryptography

package

3.1

decorator

package

4.4.2

distlib

package

0.3.1

docutils

package

0.16

filelock

package

3.0.12

futures

package

3.1.1

idna

package

2.10

importlib-metadata

package

1.7.0

iniconfig

package

1.0.1

Jinja2

package

2.11.2

jmespath

package

0.10.0

jsonschema

package

3.2.0

MarkupSafe

package

1.1.1

more-itertools

package

8.5.0

packaging

package

20.4

pluggy

package

0.13.1

protobuf

package

3.13.0

psutil

package

5.7.2

py

package

1.9.0

pyasn1

package

0.4.8

pycparser

package

2.20

pyparsing

package

2.4.7

pyrsistent

package

0.16.0

pytest

package

6.0.2

python-dateutil

package

2.8.1

pytz

package

2020.1

PyYAML

package

5.3.1

pymongo

package

3.11.0

requests

package

2.24.0

rsa

package

4.6

simplejson

package

3.17.2

six

package

1.15.0

toml

package

0.10.1

tox

package

3.20.0

urllib3

package

1.25.10

virtualenv

package

20.0.31

zipp

package

3.1.0

Python 2.7.18

Name Type Version

alabaster

package

0.7.12

appdirs

package

1.4.4

atomicwrites

package

1.4.0

attrs

package

20.2.0

Babel

package

2.8.0

backports.functools-lru-cache

package

1.6.1

blinker

package

1.4

bump2version

package

0.5.11

bumpversion

package

0.6.0

certifi

package

2020.6.20

cffi

package

1.14.2

chardet

package

3.0.4

click

package

7.1.2

colorama

package

0.4.3

configparser

package

4.0.2

contextlib2

package

0.6.0.post1

coverage

package

5.2.1

cryptography

package

3.1

decorator

package

4.4.2

distlib

package

0.3.1

docutils

package

0.16

dominate

package

2.5.2

enum34

package

1.1.10

filelock

package

3.0.12

flake8

package

3.8.3

Flask

package

1.1.2

Flask-Admin

package

1.5.7

Flask-Bootstrap

package

3.3.7.1

Flask-Cache

package

0.13.1

Flask-FlatPages

package

0.7.2

Flask-Gravatar

package

0.5.0

Flask-Login

package

0.5.0

Flask-Mail

package

0.9.1

Flask-PyMongo

package

2.3.0

Flask-Restless

package

0.17.0

Flask-SQLAlchemy

package

2.4.4

Flask-Themes

package

0.1.3

Flask-Uploads

package

0.2.1

Flask-WTF

package

0.14.3

Frozen-Flask

package

0.15

funcsigs

package

1.0.2

functools32

package

3.2.3.post2

futures

package

3.3.0

idna

package

2.10

imagesize

package

1.2.0

importlib-metadata

package

1.7.0

importlib-resources

package

3.0.0

ipaddress

package

1.0.23

itsdangerous

package

1.1.0

Jinja2

package

2.11.2

jmespath

package

0.10.0

jsonschema

package

3.2.0

Markdown

package

3.1.1

MarkupSafe

package

1.1.1

mccabe

package

0.6.1

mimerender

package

0.6.0

more-itertools

package

5.0.0

nano

package

0.10.0

networkx

package

2.2

packaging

package

20.4

pathlib2

package

2.3.5

pathtools

package

0.1.2

pluggy

package

0.13.1

protobuf

package

3.13.0

psutil

package

5.7.2

py

package

1.9.0

pyasn1

package

0.4.8

pycodestyle

package

2.6.0

pycparser

package

2.20

pyflakes

package

2.2.0

Pygments

package

2.5.2

PyJWT

package

1.7.1

pymongo

package

3.11.0

pyparsing

package

2.4.7

pyrsistent

package

0.16.0

pytest

package

4.6.11

python-dateutil

package

2.8.1

python-mimeparse

package

1.6.0

pytz

package

2020.1

PyYAML

package

5.3.1

requests

package

2.24.0

rsa

package

4.5

scandir

package

1.10.0

simplejson

package

3.17.2

singledispatch

package

3.4.0.3

six

package

1.15.0

snowballstemmer

package

2.0.0

Sphinx

package

1.8.5

sphinxcontrib-websupport

package

1.1.2

SQLAlchemy

package

1.3.19

toml

package

0.10.1

tox

package

3.20.0

typing

package

3.7.4.3

urllib3

package

1.25.10

virtualenv

package

20.0.31

visitor

package

0.1.3

watchdog

package

0.10.3

wcwidth

package

0.2.5

Werkzeug

package

1.0.1

WTForms

package

2.3.3

zip

package

0.0.2

zipp

package

1.2.0