Пример #1
0
 def testWrongFileToFilter(self):
     # If put a configuration file as the file to read, fail well
     test_input = ["-f", DEF_INI, "-c", DEF_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("could not convert string" in output)
Пример #2
0
 def testHelp(self):
     test_input = ['-h']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertFalse(output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
Пример #3
0
 def testDefInp(self):
     # testing a single file
     try:
         copy_input(TEST_INPUT)
         test_input = ["-f", TEMP_INPUT, "-c", DEF_INI]
         main(test_input)
         self.assertFalse(diff_lines(TEMP_INPUT, GOOD_OUTPUT))
     finally:
         silent_remove(TEMP_INPUT)
Пример #4
0
 def testFilePattern(self):
     # testing a single file
     try:
         for folder in FOLDERS:
             test_file = os.path.join(folder, SEED_NAME)
             copy_input(test_file)
         test_input = ["-c", DEF_INI]
         main(test_input)
         for folder in FOLDERS:
             test_output = os.path.join(folder, TEMP_PREFIX + SEED_NAME)
             good_output = os.path.join(folder, GOOD_NAME)
             self.assertFalse(diff_lines(test_output, good_output))
     finally:
         for folder in FOLDERS:
             test_output = os.path.join(folder, TEMP_PREFIX + SEED_NAME)
             silent_remove(test_output, disable=DISABLE_REMOVE)
Пример #5
0
 def testNoSuchFile(self):
     test_input = ["-f", "ghost.csv", "-c", DEF_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Problems reading file" in output)