def testDefInp(self):
     test_input = ["-c", DEF_INI, "-f", DEF_INPUT]
     try:
         main(test_input)
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
     finally:
         silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
 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)
Exemple #3
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)
Exemple #4
0
 def testDefInp(self):
     test_input = ["-c", DEF_INI, "-f", DEF_INPUT]
     try:
         main(test_input)
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
     finally:
         silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
 def testParseError(self):
     # This input has a line without equals), resulting in a parsing error we will catch
     test_input = ["-f", DEF_INPUT, "-c", PARSE_ERROR_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("parsing errors" in output)
         self.assertTrue("'col2" in output)
 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)
Exemple #7
0
 def testParseError(self):
     # This input has a line without equals), resulting in a parsing error we will catch
     test_input = ["-f", DEF_INPUT, "-c", PARSE_ERROR_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("File contains parsing errors" in output)
         self.assertTrue("'col2" in output)
Exemple #8
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)
 def testInvalidHeader(self):
     test_input = ["-f", DEF_INPUT, "-c", INVALID_HEADER_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Specified column header 'run1234' was not found in file" in output)
Exemple #10
0
 def testInvalidKey(self):
     test_input = ["-f", DEF_INPUT, "-c", TYPO_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Unexpected key" in output)
Exemple #11
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)
Exemple #12
0
 def testInvalidHeader(self):
     test_input = ["-f", DEF_INPUT, "-c", INVALID_HEADER_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Specified column header 'run1234' was not found in file" in output)
Exemple #13
0
 def testInvalidKey(self):
     test_input = ["-f", DEF_INPUT, "-c", TYPO_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Unexpected key" in output)
Exemple #14
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)