/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Attributes | Properties | Private Attributes
DybPython::dbcas::DD Class Reference

List of all members.

Public Member Functions

def Compare
def get_prep
def dif_
def __call__
def assert_
def __repr__

Static Public Attributes

tuple Compare = classmethod(Compare)
tuple dif_ = classmethod( dif_ )

Properties

 prep = property(get_prep)

Private Attributes

 _prep

Detailed Description

Compares directories contained cascade mysqldumps 
after first replacing the times from todays dates 
avoiding inevitable validity insert time differences 

Successful comparison Requires the *DbiTest* and *DybDbiTest* dumps 
to be created on the same UTC day.

Definition at line 265 of file dbcas.py.


Member Function Documentation

def DybPython::dbcas::DD::Compare (   cls,
  cas,
  dir,
  cfdir,
  reference = False 
)

Definition at line 275 of file dbcas.py.

00276                                                           :
00277         if not cfdir and reference == True:
00278             cfdir = dir 
00279         dir    = os.path.expandvars(dir)   
00280         cfdir  = os.path.expandvars(cfdir)   
00281         print "DD.Compare comparing %s with %s reference %s " % ( dir, cfdir, reference ) 
00282         assert os.path.isdir(dir), dir
00283         assert os.path.isdir(cfdir), cfdir
00284         for dbno,con in enumerate(cas):
00285             if not con.ascii:
00286                 dd = DD(dbno=dbno, dir=dir , cfdir=cfdir , reference=reference )
                print dd.assert_() 
def DybPython::dbcas::DD::get_prep (   self)
Initially this just obscured the times in UTC todays date 
(which appears in the Vld table INSERTDATE column) to 
allow comparison between DbiTest and DybDbiTest runs done on the same UTC day

However, now that are extending usage of the MYSQLDUMP reference comparisons 
to dumps of DBWriter created DB from different days, need to obscure todays date fully 

Definition at line 289 of file dbcas.py.

00290                       :
00291         """
00292         Initially this just obscured the times in UTC todays date 
00293         (which appears in the Vld table INSERTDATE column) to 
00294         allow comparison between DbiTest and DybDbiTest runs done on the same UTC day
00295 
00296         However, now that are extending usage of the MYSQLDUMP reference comparisons 
00297         to dumps of DBWriter created DB from different days, need to obscure todays date fully 
00298         """ 
00299         if not hasattr(self,'_prep'):
00300             today = datetime.utcnow().strftime("%Y-%m-%d")
00301             self._prep = Prep({re.compile("%s \d{2}:\d{2}:\d{2}" % today ):"....-..-..  ..:..:.." }) 
        return self._prep
def DybPython::dbcas::DD::dif_ (   cls,
  a,
  b,
  prep 
)

Definition at line 304 of file dbcas.py.

00305                                 :
00306         from difflib import unified_diff
        return unified_diff( map(prep,open(a).readlines()), map(prep,open(b).readlines()) , a, b )
def DybPython::dbcas::DD::__call__ (   self)

Definition at line 309 of file dbcas.py.

00310                       :
00311         ref = ".ref" if self['reference'] else ""  # IF THIS LINE GIVES SYNTAX ERROR YOU ARE USING THE WRONG PYTHON : FIX YOUR ENVIRONMENT
00312         a = os.path.join( self['dir'],   "%s.sql" % self['dbno'] )
00313         b = os.path.join( self['cfdir'], "%s.sql%s" % ( self['dbno'] , ref ) ) 
00314         print "DD a", a
00315         print "DD b", b
00316 
00317         assert os.path.exists(a) , a 
00318         if self['reference']:
00319             if not os.path.exists(b):
00320                 print "b %s does not exist, blessing a %s to reference " % ( b, a )  
00321                 shutil.copyfile( a, b)
00322         else:
00323             assert os.path.exists(b) , b
00324         p = self.prep
00325         #p = string.strip   # to see some differences
00326         return  self.dif_( a , b , p )  
    
def DybPython::dbcas::DD::assert_ (   self)

Definition at line 327 of file dbcas.py.

00328                      :
00329         assert len([l for l in self()]) == 0 , self
00330         return self
   
def DybPython::dbcas::DD::__repr__ (   self)

Definition at line 331 of file dbcas.py.

00332                       :
00333         return "\n".join(["%s %s" % ( self.__class__.__name__, dict.__repr__(self)) ] + [l for l in self()])
00334 
00335 
00336 
00337 
00338 
00339 
00340 


Member Data Documentation

tuple DybPython::dbcas::DD::Compare = classmethod(Compare) [static]

Definition at line 287 of file dbcas.py.

tuple DybPython::dbcas::DD::dif_ = classmethod( dif_ ) [static]

Definition at line 307 of file dbcas.py.

Definition at line 296 of file dbcas.py.


Property Documentation

DybPython::dbcas::DD::prep = property(get_prep) [static]

Definition at line 302 of file dbcas.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:40 for DybPython by doxygen 1.7.4