gh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)

https://github.com/python/cpython/issues/81057
This commit is contained in:
Eric Snow 2022-12-08 15:38:06 -07:00 committed by GitHub
parent c85be734d1
commit cda9f0236f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 107 additions and 27 deletions

View file

@ -606,12 +606,13 @@ class StatAttributeTests(unittest.TestCase):
def test_stat_result_pickle(self):
result = os.stat(self.fname)
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
p = pickle.dumps(result, proto)
self.assertIn(b'stat_result', p)
if proto < 4:
self.assertIn(b'cos\nstat_result\n', p)
unpickled = pickle.loads(p)
self.assertEqual(result, unpickled)
with self.subTest(f'protocol {proto}'):
p = pickle.dumps(result, proto)
self.assertIn(b'stat_result', p)
if proto < 4:
self.assertIn(b'cos\nstat_result\n', p)
unpickled = pickle.loads(p)
self.assertEqual(result, unpickled)
@unittest.skipUnless(hasattr(os, 'statvfs'), 'test needs os.statvfs()')
def test_statvfs_attributes(self):