Changes between Version 41 and Version 42 of pyrunner


Ignore:
Timestamp:
09/04/24 16:42:02 (6 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pyrunner

    v41 v42  
    9797If this glue code is there, or if you can add this glue code manually, you can use the normal procedure with {{{python -m unittest path.to.YOURTESTCLASS}}}. This only works for single classes because pip install removes all {{{__init__.py}}} files, breaking auto discovery of the tests.
    9898
    99 To debug, you would need to **install** pytest ({{{sudo apt install python3-pytest}}}) after which you can do {{{pytest-3 --trace path/to/YOURTESTCLASS.py}}}. Unfortunately there seems a bug in pytest-3 and it does not debug at the first test. This makes this approach mostly useless.
    100 
    10199Either with or without glue code, you can use runTests directly, using {{{python -c "from unitpy.Runner import runTests; from path.to.YOURTESTCLASS import YOURTESTCLASS; runTests(YOURTESTCLASS)" }}}.
    102100
    103 For debug use {{{python -c "import pdb; from unitpy.Runner import runTests; from path.to.YOURTESTCLASS import YOURTESTCLASS;  pdb.set_trace(); runTests(YOURTESTCLASS)" -m pdb}}}. We recommend then to set a breakpoint using {{{b /ABSOLUTE/PATH/TO/YOURMODULE.py:LINENR}}} instead of debugging the entire runTest code. And then use 'c' to continue to the breakpoint.
     101For debug use
     102{{{
     103python -c "import pdb; from unitpy.Runner import runTests; from path.to.YOURTESTCLASS import YOURTESTCLASS;  pdb.set_trace(); runTests(YOURTESTCLASS)" -m pdb
     104}}}.
     105We recommend then to set a breakpoint using {{{b /ABSOLUTE/PATH/TO/YOURMODULE.py:LINENR}}} instead of debugging the entire runTest code. And then use 'c' to continue to the breakpoint.
     106
     107
     108Theoretically, for debugging you would need to **install** pytest ({{{sudo apt install python3-pytest}}}) after which you can do {{{pytest-3 --trace path/to/YOURTESTCLASS.py}}}. Unfortunately there seems a bug in pytest-3 and it does not debug at the first test. This makes this approach mostly useless.
     109