Example #1
0
 def test_file_md5( self ):
     example_file = "abc\nabc\n"
     with patch( 'vasppy.utils.md5sum' ) as mock_md5sum:
         mock_md5sum.return_value = 'foo'
         with patch( 'vasppy.utils.zopen', mock_open( read_data=example_file ), create=True ) as m:
             self.assertEqual( file_md5( m ), 'foo' )
             mock_md5sum.assert_called_with( example_file )
Example #2
0
 def test_file_md5(self):
     example_file = "abc\nabc\n"
     with patch('vasppy.utils.md5sum') as mock_md5sum:
         mock_md5sum.return_value = 'foo'
         with patch('vasppy.utils.zopen',
                    mock_open(read_data=example_file),
                    create=True) as m:
             self.assertEqual(file_md5(m), 'foo')
             mock_md5sum.assert_called_with(example_file)
Example #3
0
 def print_file_tracking(self):
     if self.meta.track:
         print("file tracking:")
         for f, new_filename in self.meta.track.items():
             print("    {}:".format(f))
             if not new_filename:
                 new_filename = f
             print("        filename: {}".format(new_filename))
             filename = match_filename(self.directory + f)
             if filename:
                 md5 = file_md5(filename)
             else:
                 md5 = 'null'
             print("        md5: {}".format(md5))
Example #4
0
 def print_file_tracking( self ):
     if self.meta.track:
         print( "file tracking:" )
         for f, new_filename in self.meta.track.items():
             print( "    {}:".format( f ) )
             if not new_filename:
                 new_filename = f
             print( "        filename: {}".format( new_filename ) )
             filename = match_filename( self.directory + f )
             if filename: 
                 md5 = file_md5( filename )
             else:
                 md5 = 'null'
             print( "        md5: {}".format( md5 ) )
Example #5
0
 def print_vasprun_md5(self):
     print("vasprun md5: {}".format(
         file_md5("{}/{}".format(self.directory, self.vasprun_filename))))
Example #6
0
 def print_vasprun_md5( self ):
     print( "vasprun md5: {}".format( file_md5( "{}/{}".format( self.directory, self.vasprun_filename ) ) ) )