snakeoil icon indicating copy to clipboard operation
snakeoil copied to clipboard

TestTouch.test_set_custom_nstimes fails

Open mgorny opened this issue 5 years ago • 0 comments

I'm going to guess that the underlying file system has second precision.

________________________________________________________ TestTouch.test_set_custom_nstimes ________________________________________________________
                                                                                                                        
self = <test_fileutils.TestTouch object at 0x7ffa2bb51da0>                                            
                                                                         
    def test_set_custom_nstimes(self):          
        fileutils.touch(self.path)                   
        orig_stat = os.stat(self.path)  
        ns = (1, 1)             
        fileutils.touch(self.path, ns=ns)
        new_stat = os.stat(self.path)
                                                                                                
        # system doesn't have nanosecond precision, try microseconds                           
        if new_stat.st_atime == 0:                                                                  
            ns = (1000, 1000)                                                                              
            fileutils.touch(self.path, ns=ns)                                         
            new_stat = os.stat(self.path)                             

        assert orig_stat != new_stat                     
>       assert ns[0] == new_stat.st_atime_ns
E       assert 1000 == 0                                        
E         -1000
E         +0                                      

../../snakeoil-0.8.8/tests/module/test_fileutils.py:60: AssertionError

mgorny avatar May 07 '20 12:05 mgorny