Example #1
0
def output_of_runme_on(input_file):
    # call runme.main and get its output into from_main
    with io.StringIO() as target_output_stream:
        # redirect stdout to an io.StringIO object to run main
        sys.stdout, old_stdout = target_output_stream, sys.stdout
        runme.main(input_file)
        from_main = target_output_stream.getvalue()
        # get original stdout back
        sys.stdout = old_stdout
    return from_main
Example #2
0
    def on_modified(self, event):

        file_name = event.src_path.replace(path,"")
        tmp = file_name.split(".")

        if tmp[1] == "jinja":
            runme.main()

        if tmp[1] == "scss":
            print 'scss -> css'
            cmd = 'sass ' + file_name + ' ' + tmp[0] + ".css"
            os.system(cmd)

        self.process(event)
Example #3
0
 def test_main_on_sample_in(self):
     # call runme.main and get its output into from_main
     with io.StringIO() as target_output_stream:
         # redirect stdout to an io.StringIO object to run main
         sys.stdout, old_stdout = target_output_stream, sys.stdout
         runme.main("sample.in")
         from_main = target_output_stream.getvalue()
         # get original stdout back
         sys.stdout = old_stdout
     # get the "sample.out" file's contents
     with open("sample.out", "r") as sample_out:
         from_sample_out = sample_out.read()
     # compare runme.main's results with sample.out's contents
     self.assertEqual(from_main, from_sample_out)
Example #4
0
 def test_main_on_sample_in(self):
     # call runme.main and get its output into from_main
     with io.StringIO() as target_output_stream:
         # redirect stdout to an io.StringIO object to run main
         sys.stdout, old_stdout = target_output_stream, sys.stdout
         runme.main('sample.in')
         from_main = target_output_stream.getvalue()
         # get original stdout back
         sys.stdout = old_stdout
     # get the 'sample.out' file's contents
     with open('sample.out', 'r', encoding='utf-8') as sample_out:
         from_sample_out = sample_out.read()
     # compare runme.main's results with sample.out's contents
     self.assertEqual(from_main, from_sample_out)
Example #5
0
 def launch():
     import runme
     runme.main()
Example #6
0
 def on_modified(self, event):
     runme.main()
     self.process(event)