functions and branching working on the same codebut can also be quite useful for your own projects the recommended and most widely used tool is called pytest or py testwhere pytest is simply the new name for py test we can run pytest from the terminal windowand pass it either file name or folder name as an argumentas in terminal terminalpytest terminalpytest my_python_project py if we pass it file namepytest will look for functions in this file with name starting with test_as specified by the naming convention above all these functions will be identified as test functions and called by pytestregardless of whether the test functions are actually called from elsewhere in the code after executionpytest will print short summary of how many tests it foundand how many that passed and failed for larger software projectsit might be more relevant to give directory name as argument to pytestas in the first line above in this casethe tool will search the given directory (here the directory we are currently inand all its sub-directories for python files with names starting or ending with test ( test_math pymath_test pyetc all these files will be searched for test functions following the naming conventionand these will be run as above large software projects typically have thousands of test functionsand it is very convenient to collect them in separate file and use automatic tools such as pytest for the smaller programs we write in this courseit can be just as easy to write the test functions in the same file as the functions being tested it is important to remember that test functions run silently if the test passesthat iswe only obtain an output if there is an assertion errorotherwise nothing is printed to the screen when using pytest we are always given summary specifying how many tests were runbut if we include calls to the test functions directly in the py fileand run this file as normalthere will be no output if the test passes this can be confusingand one is sometimes left wondering if the test was called at all when first writing test functionit can be useful to include print-statement inside the functionsimply to verify that the function is actually called this statement should be removed once we know the function works correctly and as we become used to how the test functions work open access dieses kapitel wird unter der creative commons namensnennung international lizenz (in jeglichem medium und format erlaubtsofern sie den/die ursprunglichen autor(enund die quelle ordnungsgemass nenneneinen link zur creative commons lizenz beifugen und angebenob anderungen vorgenommen wurden die in diesem kapitel enthaltenen bilder und sonstiges drittmaterial unterliegen ebenfalls der genannten creative commons lizenzsofern sich aus der abbildungslegende nichts anderes ergibt sofern das betreffende material nicht unter der genannten creative commons lizenz steht und die betreffende handlung nicht nach gesetzlichen vorschriften erlaubt istist fur die oben aufgefuhrten weiterverwendungen des materials die einwilligung des jeweiligen rechteinhabers einzuholen