@@ -648,9 +648,10 @@ def check_timestamp_agreement(self, result, names):
648648 # Make sure that the st_?time and st_?time_ns fields roughly agree
649649 # (they should always agree up to around tens-of-microseconds)
650650 for name in names :
651- floaty = int (getattr (result , name ) * 100_000 )
652- nanosecondy = getattr (result , name + "_ns" ) // 10_000
653- self .assertAlmostEqual (floaty , nanosecondy , delta = 2 , msg = name )
651+ with self .subTest (name = name ):
652+ floaty = int (getattr (result , name ) * 100_000 )
653+ nanosecondy = getattr (result , name + "_ns" ) // 10_000
654+ self .assertAlmostEqual (floaty , nanosecondy , delta = 2 , msg = name )
654655
655656 def check_stat_attributes (self , fname ):
656657 result = os .stat (fname )
@@ -741,14 +742,19 @@ def test_stat_result_pickle(self):
741742 unpickled = pickle .loads (p )
742743 self .assertEqual (result , unpickled )
743744
744- def check_statx_attributes (self , fname ):
745+ def check_statx_attributes (self , filename ):
745746 maximal_mask = 0
746747 for name in dir (os ):
747748 if name .startswith ('STATX_' ):
748749 maximal_mask |= getattr (os , name )
749- result = os .statx (self .fname , maximal_mask )
750+ result = os .statx (filename , maximal_mask )
751+ basic_result = os .stat (filename )
750752
751753 time_attributes = ('st_atime' , 'st_mtime' , 'st_ctime' , 'st_birthtime' )
754+ # gh-83714: st_birthtime can be None on tmpfs even if STATX_BTIME mask
755+ # is used
756+ time_attributes = [name for name in time_attributes
757+ if getattr (result , name ) is not None ]
752758 self .check_timestamp_agreement (result , time_attributes )
753759
754760 # Check that valid attributes match os.stat.
@@ -773,7 +779,6 @@ def check_statx_attributes(self, fname):
773779 ('st_rdev' , 0 ),
774780 ('st_dev' , 0 ),
775781 )
776- basic_result = os .stat (self .fname )
777782 for name , bits in requirements :
778783 if result .stx_mask & bits == bits and hasattr (basic_result , name ):
779784 x = getattr (result , name )
0 commit comments