Changes between Version 25 and Version 26 of pyrunner


Ignore:
Timestamp:
08/21/24 10:45:14 (3 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pyrunner

    v25 v26  
    8181}}}
    8282
    83 === Running/Debugging tests from commandline
    84 Running and Debugging a unit test from the commandline is a bit more tricky because python can not find tests in a zip file. Nor can it find them after unzipping, because pip install removes some files. We suggest to use unitpy to work around these issues.
     83=== Running/Debugging unitpy tests
     84If the unittests are using [unitpy], the test class does not need to extend TestCase and is by itself not discoverable.
     85If the test class was compiled with the j2p and the junit-t translator, then a bit of glue code has been added to your class. This glue code looks like this:
     86{{{
     87class Test(TestCase):
     88 def test(self):
     89  runTests(YOURTESTCLASS)
     90}}}
    8591
    86 * make a venv and activate
    87 * pip install the zip
    88 * pip install [source:/unitpy/dist unitypy]
    89 *
     92If 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}}}.
     93
     94If the class uses unitpy but the glue code is not there, you can use runTests directly, using {{{python -c "from unitpy.Runner import runTests; import path.to.YOURTESTCLASS; runTests(YOURTESTCLASS)" }}}. You can add {{{-m pdb}}} to debug this run.