package com.chaquo.python.demo;

import com.chaquo.python.*;

public class PythonTestActivity extends UnitTestActivity {

    @Override
    protected void runTests() {
        Python python = Python.getInstance();
        PyObject unittest = python.getModule("unittest");
        PyObject suite = python.getModule("chaquopy.test");
        PyObject stream = python.getModule("sys").get("stdout");
        PyObject runner = unittest.callAttr("TextTestRunner",
                                            new Kwarg("stream", stream),
                                            new Kwarg("verbosity", 2));
        PyObject loader = unittest.get("defaultTestLoader");
        runner.callAttr("run", loader.callAttr("loadTestsFromModule", suite));
    }

}

@@ -178,20 +178,16 @@
 ython py
-thon
  = Pytho
@@ -229,28 +229,24 @@
 nittest = py
-thon
 .getModule(%22
@@ -279,21 +279,18 @@
 ct s
-uite
+tream
  = py
-thon
 .get
@@ -301,89 +301,67 @@
 le(%22
-chaquopy.tes
+sys%22).get(%22stdou
 t%22);
-%0A
   
-      PyObject stream = python.getModule(%22sys%22).get(%22stdout%22);
+// https://bugs.python.org/issue10786
 %0A   
@@ -637,30 +637,24 @@
     
-runner.callAttr(%22run%22,
+PyObject suite =
  loa
@@ -692,16 +692,78 @@
 le%22,
+ py.getModule(%22chaquopy.test%22));%0A        runner.callAttr(%22run%22,
  suite)
-)
 ;%0A  

Tidy up PythonTestActivity and add comment