Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 5
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("parsing errors" in output)
         self.assertTrue("'col2" in output)
Ejemplo n.º 6
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 9
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)