diff --git a/README.rst b/README.rst index f4ab3ffced9b52ca246389d77a68764a30640c53..12c3b689512e86cf9bb3bc10b8e95db7c317f9e4 100644 --- a/README.rst +++ b/README.rst @@ -32,6 +32,7 @@ Deckard requires following software to be installed: - python-augeas_ - Python bindings for augeas API - pytest_ - testing framework for Python, used for running the test cases - pytest-xdist_ - module for pytest for distributed testing +- pytest-forked_ - module for pytest for testing in forked subprocesses - pyroute2_ - Python netlink library (managing IP addresses, routes,…) - dumpcap_ - command line tool for network capture (part of Wireshark) - faketime_ - used for faking the time in tests of DNSSEC @@ -89,5 +90,6 @@ Happy testing. .. _`python-augeas`: https://pypi.org/project/python-augeas/ .. _`pytest`: https://pytest.org/ .. _`pytest-xdist`: https://pypi.python.org/pypi/pytest-xdist +.. _`pytest-forked`: https://pypi.python.org/pypi/pytest-forked .. _`pyroute2`: https://pyroute2.org/ .. _`dumpcap`: https://www.wireshark.org/docs/man-pages/dumpcap.html diff --git a/doc/user_guide.rst b/doc/user_guide.rst index ed9462075939f8c6ce42f16a864038aa6003485a..4ae8f9780307ae4229708adcd819af735b7d851f 100644 --- a/doc/user_guide.rst +++ b/doc/user_guide.rst @@ -48,7 +48,7 @@ As mentioned above we use `py.test` to run the tests so all possible command lin Here is a list of the most useful ones: -- ``-n number`` – runs the testing in parallel with ``number`` of processes (this requires `pytest-xdist` to be installed) +- ``-n number`` – runs the testing in parallel with ``number`` of processes (this requires `pytest-xdist` and `pytest-forked` to be installed) - ``-k EXPRESSION`` – only run tests which match the given substring expression (e.g. ``./kresd_run -k "world_"`` will only run the scenarios with `world_` in their file name. - ``--collectonly`` – only print the names of selected tests, no tests will be run - ``--log-level DEBUG`` – print all debug information for failed tests diff --git a/requirements.txt b/requirements.txt index a585608eeb07c1abbdc294d4022092f48fb005fb..900b86b2eb95fda398e1c125159addabeffadd4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ PyYAML python-augeas pytest>=3.4 pytest-xdist +pytest-forked pyroute2 diff --git a/run.sh b/run.sh index fb8fead2478ff83510ab23752631fc9386bc911e..911fce591056a34e9d9cac3a8e31f1f38ecd5fe6 100755 --- a/run.sh +++ b/run.sh @@ -3,9 +3,9 @@ MAKEDIR="$(dirname "$0")" # Currently there no tests requiring faking monotonic time in this repository (there are some elsewhere) # pytest returns code 5 on "no tests were run" so we just ignore it -faketime -m "" python3 -m pytest -c "${MAKEDIR}/deckard_pytest.ini" --tb=short -q ${VERBOSE:+"--log-level=DEBUG"} "${MAKEDIR}" ${DECKARDFLAGS:-} ${TESTS:+"--scenarios=${TESTS}"} -m "monotonic" --boxed "$@" +faketime -m "" python3 -m pytest -c "${MAKEDIR}/deckard_pytest.ini" --tb=short -q ${VERBOSE:+"--log-level=DEBUG"} "${MAKEDIR}" ${DECKARDFLAGS:-} ${TESTS:+"--scenarios=${TESTS}"} -m "monotonic" --forked "$@" MONO_RES=$(( $? == 5 ? 0 : $? )) -faketime -m --exclude-monotonic "" python3 -m pytest -c "${MAKEDIR}/deckard_pytest.ini" --tb=short -q ${VERBOSE:+"--log-level=DEBUG"} "${MAKEDIR}" ${DECKARDFLAGS:-} ${TESTS:+"--scenarios=${TESTS}"} -m "not monotonic" --boxed "$@" +faketime -m --exclude-monotonic "" python3 -m pytest -c "${MAKEDIR}/deckard_pytest.ini" --tb=short -q ${VERBOSE:+"--log-level=DEBUG"} "${MAKEDIR}" ${DECKARDFLAGS:-} ${TESTS:+"--scenarios=${TESTS}"} -m "not monotonic" --forked "$@" NONMONO_RES=$(( $? == 5 ? 0 : $? )) if [ $NONMONO_RES -ne 0 ]