# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import unittest import sys from functest import reports class UnitTestReporter(reports.FunctestReportInterface): def summary(self, test_list, totals_dict, stdout_capture): self.test_list = test_list unittestreporter = UnitTestReporter() reports.register_reporter(unittestreporter) class WindmillUnitTestCase(unittest.TestCase): def setUp(self): import windmill windmill.stdout, windmill.stdin = sys.stdout, sys.stdin from windmill.bin.admin_lib import configure_global_settings, setup configure_global_settings() windmill.settings['TEST_URL'] = self.test_url if hasattr(self,"windmill_settings"): for (setting,value) in self.windmill_settings.iteritems(): windmill.settings[setting] = value self.windmill_shell_objects = setup() def testWindmill(self): self.windmill_shell_objects['start_'+self.browser]()
from functest import reports import sys class MyReport(reports.FunctestReportInterface): def summary(self, test_list, totals_dict, stdout_capture): sys.__stdout__.write("all tests list "+str(test_list)+'\n') sys.__stdout__.write('--stdout--'+stdout_capture) sys.__stdout__.flush() def test_function(self, test_function): sys.__stdout__.write("Finished test_function: "+test_function.__name__) def setup_module(self, test_function): sys.__stdout__.write("Finished setup_module: "+test_function.__name__) def teardown_module(self, test_function): sys.__stdout__.write("Finished teardown_module: "+test_function.__name__) reports.register_reporter(MyReport()) def test_stub(): print 'capture in stdout' def setup_module(module): pass def teardown_module(module): pass