2020-02-22 22:55:25 +00:00
|
|
|
# tox.ini
|
|
|
|
# Run tests of wexpect in multiple configuration.
|
|
|
|
|
|
|
|
[tox]
|
|
|
|
# The following configuration will run automatically.
|
2020-04-05 11:30:31 +00:00
|
|
|
envlist = py{37}-{legacy_wexpect,spawn_pipe,spawn_socket},installed,pyinstaller
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
|
|
|
|
[testenv]
|
|
|
|
description = Unit tests
|
|
|
|
|
|
|
|
# Set environment variables to select the proper configuration for each envirnment.
|
|
|
|
setenv =
|
|
|
|
spawn_pipe: WEXPECT_SPAWN_CLASS=SpawnPipe
|
|
|
|
legacy_wexpect: WEXPECT_SPAWN_CLASS=legacy_wexpect
|
2020-04-05 11:30:31 +00:00
|
|
|
spawn_socket: WEXPECT_SPAWN_CLASS=SpawnSocket
|
2020-02-22 22:55:25 +00:00
|
|
|
|
|
|
|
commands =
|
|
|
|
# install the dependencies:
|
|
|
|
pip install .[test]
|
|
|
|
|
|
|
|
# Run the test itself
|
2020-02-28 16:34:42 +00:00
|
|
|
coverage run --parallel-mode -m unittest
|
|
|
|
|
|
|
|
# Combine the parallel results
|
|
|
|
coverage combine
|
2020-02-22 22:55:25 +00:00
|
|
|
|
|
|
|
# Dump coverage summary to console
|
|
|
|
coverage report --omit=tests/*,site-packages/*
|
|
|
|
|
|
|
|
# Convert coverage report to standard xml formula the filename includes the tox environment name
|
|
|
|
# https://tox.readthedocs.io/en/latest/config.html#environment-variable-substitutions
|
|
|
|
coverage xml --omit=tests/*,site-packages -o {env:TOX_ENV_NAME}_coverage.xml
|
|
|
|
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
[testenv:installed]
|
2020-03-31 07:50:14 +00:00
|
|
|
# normal tests test the cloned files. This testenv tests the installation itself, with the default
|
|
|
|
# spawn class.
|
|
|
|
description = Unit tests installed, and default spawn class.
|
2020-02-22 22:55:25 +00:00
|
|
|
|
|
|
|
changedir = test_01_installed
|
|
|
|
|
2020-03-31 07:50:14 +00:00
|
|
|
whitelist_externals =
|
2020-02-23 14:20:23 +00:00
|
|
|
cp
|
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
commands =
|
|
|
|
# copy all testcase into working dir
|
|
|
|
cp -r ../tests tests
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-04-05 11:30:31 +00:00
|
|
|
|
2020-03-31 07:50:14 +00:00
|
|
|
# Run the test itself. Running all tests is not needed, because it just test the installation,
|
|
|
|
# not functions.
|
|
|
|
python -m unittest tests.test_misc
|
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
|
|
|
|
[testenv:pyinstaller]
|
|
|
|
# Test if wexpect working with pyinstaller. See #12 for more details.
|
|
|
|
description = Unit tests pyinstaller
|
|
|
|
|
2020-03-31 07:50:14 +00:00
|
|
|
whitelist_externals =
|
2020-02-23 14:20:23 +00:00
|
|
|
pyinstaller
|
|
|
|
pyinstaller_test
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-23 14:20:23 +00:00
|
|
|
setenv =
|
|
|
|
WEXPECT_SPAWN_CLASS=SpawnPipe
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
commands =
|
2020-02-23 14:20:23 +00:00
|
|
|
# install the dependencies:
|
|
|
|
pip install .[test]
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
# create wexpect executable for console-reader.
|
|
|
|
pyinstaller wexpect.spec
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
# create test executable, to thest the console-reader
|
|
|
|
pyinstaller tests/pyinstaller_test.py
|
2020-03-31 07:50:14 +00:00
|
|
|
|
2020-02-22 22:55:25 +00:00
|
|
|
# run test:
|
|
|
|
dist\pyinstaller_test\pyinstaller_test.exe
|