def test_captures_stdout(self): c = Capture() c.start() print "Hello" c.end() self.assertEqual(c.buffer, "Hello\n")
def test_captures_nonascii_stdout(self): c = Capture() c.start() print "test 日本" c.end() self.assertEqual(c.buffer, "test 日本\n")
def test_enabled_by_default(self): c = Capture() assert c.enabled
def test_captured_stdout_has_encoding_attribute(self): c = Capture() c.start() self.assertNotEqual(sys.stdout, sys.__stdout__) self.assertTrue(hasattr(sys.stdout, 'encoding')) c.end()
from nose.plugins.multiprocess import MultiProcess import testconfig from testconfig import TestConfig, config from nose.plugins.capture import Capture import sys from nose.plugins.xunit import Xunit from ConfigParser import SafeConfigParser if __name__ == '__main__': #nose.main(argv=['nosetests','-s','-v','--processes=10']) #nose.main(argv=['nosetests','-s','-v']) #nose.run(argv=['nosetests','-v', '--processes=10','--tc-file','config1.ini'], plugins=[MultiProcess(),TestConfig()]) configFile = sys.argv[1] parser = SafeConfigParser() #path_to_project = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) parser.read(configFile) xunitFile = parser.get('TEST_CONFIG', 'xunitFile') #config['rc_configuration']['command'] print xunitFile nose.run(argv=[ 'nosetests', '-v', '-s', '--with-xunit', '--xunit-file=' + xunitFile, '--tc-file', configFile ], plugins=[TestConfig(), Capture(), Xunit()]) #thread.start_new_thread(nose.run,(['nosetests','-s','--tc-file','config1.ini'],[TestConfig(),Capture()])) #nose.run(argv=['nosetests', '-v','-s', '--processes=10']) #testThread('config1.ini').start() #testThread('config2.ini').start()
def setUp(self): super(TestOwsChecker, self).setUp() self.capture = Capture() self.capture.begin()
n + 1, target) # print preferences (setting happens in RunTestCase.runTest()) utils.print_single_prefs(prefs_dict, set_prefs=prefs) else: # None print "Running {} with default preferences".format(target) # RunTestCase.runTest() needs a dictionary prefs_dict = {} image_dir = os.path.join(target_image_dir, utils.dict_to_name(prefs_dict)) success = nose.run(argv=argv, plugins=[ SelectFilesPlugin(target_list, image_dir, prefs_dict), Capture(), Xunit() ]) successes.append(success) print "\nTARGET: {}".format(target.upper()) all_success = utils.check_success(successes, all_prefs_combinations) all_successes.append(all_success) if len(args.targets) > 1: print "\nFINISHED ALL TARGETS" if all(all_successes): print "\nALL TARGETS PASSED" else: