def testConsolePrint(self):
     if sys.version_info[0] == 3:
         tmp_file = io.StringIO()
         stdout = sys.stdout
         sys.stdout = tmp_file
         try:
             rinterface.consolePrint('haha')
         except Exception as e:
             sys.stdout = stdout
             raise e
         sys.stdout = stdout
         tmp_file.flush()
         tmp_file.seek(0)
         self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
         tmp_file.close()
     else:
         # no need to test which Python 2, only 2.7 supported
         tmp_file = tempfile.NamedTemporaryFile()
         stdout = sys.stdout
         sys.stdout = tmp_file
         try:
             rinterface.consolePrint('haha')
         except Exception as e:
             sys.stdout = stdout
             raise e
         sys.stdout = stdout
         tmp_file.flush()
         tmp_file.seek(0)
         self.assertEqual('haha', ''.join(s.decode() for s in tmp_file))
         tmp_file.close()
示例#2
0
 def testConsolePrint(self):
     if sys.version_info[0] == 3:
         tmp_file = io.StringIO()
         stdout = sys.stdout
         sys.stdout = tmp_file
         try:
             rinterface.consolePrint('haha')
         except Exception as e:
             sys.stdout = stdout
             raise e
         sys.stdout = stdout
         tmp_file.flush()
         tmp_file.seek(0)
         self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
         tmp_file.close()
     else:
         # no need to test which Python 2, only 2.7 supported
         tmp_file = tempfile.NamedTemporaryFile()
         stdout = sys.stdout
         sys.stdout = tmp_file
         try:
             rinterface.consolePrint('haha')
         except Exception as e:
             sys.stdout = stdout
             raise e
         sys.stdout = stdout
         tmp_file.flush()
         tmp_file.seek(0)
         self.assertEqual('haha', ''.join(s.decode() for s in tmp_file))
         tmp_file.close()
示例#3
0
 def testConsolePrint(self):
     tmp_file = tempfile.NamedTemporaryFile()
     stdout = sys.stdout
     sys.stdout = tmp_file
     try:
         rinterface.consolePrint('haha')
     except Exception, e:
         sys.stdout = stdout
         raise e
 def testConsolePrint(self):
     tmp_file = tempfile.NamedTemporaryFile()
     stdout = sys.stdout
     sys.stdout = tmp_file
     try:
         rinterface.consolePrint('haha')
     except Exception, e:
         sys.stdout = stdout
         raise e
示例#5
0
 def testConsolePrint(self):
     tmp_file = io.StringIO()
     stdout = sys.stdout
     sys.stdout = tmp_file
     try:
         rinterface.consolePrint('haha')
     finally:
         sys.stdout = stdout
     tmp_file.flush()
     tmp_file.seek(0)
     self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
     tmp_file.close()
示例#6
0
 def testConsolePrint(self):
     if sys.version_info[0] == 3:
         tmp_file = io.StringIO()
         stdout = sys.stdout
         sys.stdout = tmp_file
         try:
             rinterface.consolePrint('haha')
         except Exception, e:
             sys.stdout = stdout
             raise e
         sys.stdout = stdout
         tmp_file.flush()
         tmp_file.seek(0)
         self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
         tmp_file.close()
示例#7
0
 def testConsolePrint(self):
     if sys.version_info[0] == 3:
         tmp_file = io.StringIO()
         stdout = sys.stdout
         sys.stdout = tmp_file
         try:
             rinterface.consolePrint('haha')
         except Exception, e:
             sys.stdout = stdout
             raise e
         sys.stdout = stdout
         tmp_file.flush()
         tmp_file.seek(0)
         self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
         tmp_file.close()
示例#8
0
                rinterface.consolePrint('haha')
            except Exception, e:
                sys.stdout = stdout
                raise e
            sys.stdout = stdout
            tmp_file.flush()
            tmp_file.seek(0)
            self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
            tmp_file.close()
        else:
            # no need to test which Python 2, only 2.7 supported
            tmp_file = tempfile.NamedTemporaryFile()
            stdout = sys.stdout
            sys.stdout = tmp_file
            try:
                rinterface.consolePrint('haha')
            except Exception, e:
                sys.stdout = stdout
                raise e
            sys.stdout = stdout
            tmp_file.flush()
            tmp_file.seek(0)
            self.assertEqual('haha', ''.join(s.decode() for s in tmp_file))
            tmp_file.close()


    def testCallErrorWhenEndedR(self):
        if sys.version_info[0] == 2 and sys.version_info[1] < 6:
            self.assertTrue(False) # cannot be tested with Python < 2.6
            return None
        import multiprocessing
示例#9
0
                rinterface.consolePrint('haha')
            except Exception, e:
                sys.stdout = stdout
                raise e
            sys.stdout = stdout
            tmp_file.flush()
            tmp_file.seek(0)
            self.assertEqual('haha', ''.join(s for s in tmp_file).rstrip())
            tmp_file.close()
        else:
            # no need to test which Python 2, only 2.7 supported
            tmp_file = tempfile.NamedTemporaryFile()
            stdout = sys.stdout
            sys.stdout = tmp_file
            try:
                rinterface.consolePrint('haha')
            except Exception, e:
                sys.stdout = stdout
                raise e
            sys.stdout = stdout
            tmp_file.flush()
            tmp_file.seek(0)
            self.assertEqual('haha', ''.join(s.decode() for s in tmp_file))
            tmp_file.close()

    def testCallErrorWhenEndedR(self):
        if sys.version_info[0] == 2 and sys.version_info[1] < 6:
            self.assertTrue(False)  # cannot be tested with Python < 2.6
            return None
        import multiprocessing