Skip to content

Commit a02eac0

Browse files
committed
Add os.supports_dir_fd to test.pythoninfo
Split the attribute lists so the 'supports_*' names don't need to be repeated twice. Add 'supports_dir_fd'.
1 parent a831abb commit a02eac0

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎Lib/test/pythoninfo.py‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,21 +247,23 @@ def collect_urandom(info_add):
247247
def collect_os(info_add):
248248
import os
249249

250-
def format_attr(attr, value):
251-
if attr in ('supports_follow_symlinks', 'supports_fd',
252-
'supports_effective_ids'):
253-
return str(sorted(func.__name__ for func in value))
254-
else:
255-
return value
256-
257-
attributes = (
250+
plain_attributes = (
258251
'name',
259252
'supports_bytes_environ',
253+
)
254+
copy_attributes(info_add, os, 'os.%s', plain_attributes)
255+
256+
def format_set_of_functions(attr, value):
257+
return str(sorted(func.__name__ for func in value))
258+
259+
supports_attributes = (
260+
'supports_dir_fd',
260261
'supports_effective_ids',
261262
'supports_fd',
262263
'supports_follow_symlinks',
263264
)
264-
copy_attributes(info_add, os, 'os.%s', attributes, formatter=format_attr)
265+
copy_attributes(info_add, os, 'os.%s', supports_attributes,
266+
formatter=format_set_of_functions)
265267

266268
for func in (
267269
'cpu_count',

0 commit comments

Comments
 (0)