{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Pytest\n\nExecute lines from this file from demo folder to run all subsequent pytest scripts.\n\n.. hint::\n from pytest verion ``5.x`` onwards make sure to use -p no:faulthandler\n\nRun pytest using line below. run it from within the pytestfolder in the demo scripts itom folder\nmodules that are import ed once dont get reimportet, so restart itom frequently\ncapturing stdin/out/err is not possible since os.openfd is not supported by itom\nrun from within itom console...\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import pytest\n\n\n# this one collects ALL the scripts from the topLevelfolder(..)\n# omit the collect-only switch to run them all\npytest.main([\"../\", \"-v\", \"--capture=no\", \"--collect-only\", \"-c=./pytest.ini\"])\n# this one runs only tests from certain file\npytest.main([\"../demoDataObject.py\", \"--capture=no\", \"-c=./pytest.ini\"])\n# and there are many more mnipulations possible, documented on http://pytest.org/en/latest/\n# Configuration is more easily done in the *.ini and conftest.py files.\n# So here two more helpful examples:\n# this one runs all the demo functions\npytest.main(\n [\"../\", \"-v\", \"--capture=no\", \"--collect-only\", \"-c=./pytest_demo.ini\"]\n)\n# this one runs all the user demo functions, which require interaction from the user.\npytest.main([\"../\", \"-v\", \"--capture=no\", \"-c=./pytest_userdemo.ini\"])" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 0 }