| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -648,9 +648,10 @@ def check_timestamp_agreement(self, result, names): | |||
| 648 | 648 | # Make sure that the st_?time and st_?time_ns fields roughly agree | |
| 649 | 649 | # (they should always agree up to around tens-of-microseconds) | |
| 650 | 650 | 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) | ||
| 654 | 655 | ||
| 655 | 656 | def check_stat_attributes(self, fname): | |
| 656 | 657 | result = os.stat(fname) | |
@@ -741,14 +742,19 @@ def test_stat_result_pickle(self): | |||
| 741 | 742 | unpickled = pickle.loads(p) | |
| 742 | 743 | self.assertEqual(result, unpickled) | |
| 743 | 744 | ||
| 744 | - def check_statx_attributes(self, fname): | ||
| 745 | + def check_statx_attributes(self, filename): | ||
| 745 | 746 | maximal_mask = 0 | |
| 746 | 747 | for name in dir(os): | |
| 747 | 748 | if name.startswith('STATX_'): | |
| 748 | 749 | 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) | ||
| 750 | 752 | ||
| 751 | 753 | 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] | ||
| 752 | 758 | self.check_timestamp_agreement(result, time_attributes) | |
| 753 | 759 | ||
| 754 | 760 | # Check that valid attributes match os.stat. | |
@@ -773,7 +779,6 @@ def check_statx_attributes(self, fname): | |||
| 773 | 779 | ('st_rdev', 0), | |
| 774 | 780 | ('st_dev', 0), | |
| 775 | 781 | ) | |
| 776 | - basic_result = os.stat(self.fname) | ||
| 777 | 782 | for name, bits in requirements: | |
| 778 | 783 | if result.stx_mask & bits == bits and hasattr(basic_result, name): | |
| 779 | 784 | x = getattr(result, name) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments