| 36 | === Running python unit tests |
| 37 | PythonVenv also has support to run unit tests with discovery. |
| 38 | Your java code is assumed to have ...Test.java files that are compiled into your PythonVenv, eg using java2python like this |
| 39 | {{{ |
| 40 | PyProgram tests = PyProgram.fromDirectories(Arrays.asList(src, test)); |
| 41 | }}} |
| 42 | |
| 43 | The src and test dir can have overlapping modules as usual in java (eg, you have {{{geniuswebsrc/issuevalue/Bid.java}}} and a matching {{{geniuswebtest/issuevalue/BidTest.java}}}. This results in the tests in the same directory in the compiled code, while being separate in the sources. Having it all in a single zip file allows for all dependencies, both for the code and for the testing, to be installed in one go. |
| 44 | |
| 45 | Then you run the test using |
| 46 | |
| 47 | {{{ |
| 48 | PythonVenv py = new PythonVenv(tests.getZip(), logger); |
| 49 | TestResult res = py.test("geniusweb", 60000); |
| 50 | }}} |
| 51 | |