Example #1
0
    def run(self):
        """
            Its a thread main function.
            Mainly,  compares XML provided files.
            Execution is synchronised using two semaphores.
        """
        result = False
        try:
            logging.debug("Comparing => %s" %(self.name))

            with Dispatcher.__semaphore:
                result = XMLReader.compare(self.expectfile, self.resultfile)

        except:
            logging.debug("Unknown exception occured")
        finally:
            status = "[Pass]" if (result == True) else "[Fail]"
            output = "{0:80} {1}".format(self.relfilename, status)
            logging.info("%s" %(output))

            # synchronisation locking
            with  Dispatcher.__lock:
                if (result ==  True):
                    Dispatcher.__pass = Dispatcher.__pass + 1
                Dispatcher.__total = Dispatcher.__total + 1
Example #2
0
 def test_invalid_file(self):
      self.assertRaises(IOError,XMLReader,'ABCTEMP.xml')
      self.assertRaises(AssertionError,XMLReader,'')
      self.assertFalse(XMLReader.compare('/C/.xml',''))
      self.assertFalse(XMLReader.compare('', '/C/.xml'))
Example #3
0
 def test_normal(self):
      self.assertTrue(XMLReader.compare(r'Expected/foo.xml', r'Expected/foo.xml'))
      self.assertFalse(XMLReader.compare(r'Expected/foo.xml', r'Expected/bar.xml'))
      self.assertFalse(XMLReader.compare(r'Expected/foo.xml', r'Expected/foo_rowdel.xml'))
      self.assertFalse(XMLReader.compare(r'Expected/bar.xml', r'Expected/bar_casechanged.xml'))