cpython/Lib/test
Cody Maloney 35d8ac7cd7
GH-120754: Disable buffering in Path.read_bytes (#122111)
`Path.read_bytes()` is used to read a whole file. buffering /
BufferedIO is focused around making small, possibly interleaved,
read/write efficient which doesn't add value in this case.

On my Mac, running the benchmark:

```python
import pyperf
from pathlib import Path

def read_all(all_paths):
    for p in all_paths:
        p.read_bytes()

def read_file(path_obj):
    path_obj.read_bytes()

all_rst = list(Path("Doc").glob("**/*.rst"))
all_py = list(Path(".").glob("**/*.py"))
assert all_rst, "Should have found rst files"
assert all_py, "Should have found python source files"

runner = pyperf.Runner()
runner.bench_func("read_file_small", read_file, Path("Doc/howto/clinic.rst"))
runner.bench_func("read_file_large", read_file, Path("Doc/c-api/typeobj.rst"))
```

before:
```python
.....................
read_file_small: Mean +- std dev: 6.80 us +- 0.07 us
.....................
read_file_large: Mean +- std dev: 10.8 us +- 0.2 us
````

after:
```python
.....................
read_file_small: Mean +- std dev: 5.67 us +- 0.05 us
.....................
read_file_large: Mean +- std dev: 9.77 us +- 0.52 us
```
2024-08-16 13:52:41 -07:00
..
archivetestdata
audiodata
certdata gh-118658: Return consistent types from get_un/verified_chain in SSLObject and SSLSocket (#118669) 2024-08-16 22:27:44 +02:00
cjkencodings
configdata
crashers
data
decimaltestdata
dtracedata
encoded_modules
leakers
libregrtest gh-116622: Add Android test script (#121595) 2024-08-16 13:00:29 +08:00
mathdata gh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj (#122638) 2024-08-04 10:05:30 +01:00
regrtestdata/import_from_tests
subprocessdata
support gh-117482: Make the Slot Wrapper Inheritance Tests Much More Thorough (gh-122867) 2024-08-12 19:19:33 +00:00
test_ast Fix typos in comments and test code (#122846) 2024-08-11 21:16:41 -07:00
test_asyncio Fix typos in comments and test code (#122846) 2024-08-11 21:16:41 -07:00
test_capi GH-122821: Simplify compilation of while statements to ensure consistency of offsets for sys.monitoring (GH-122934) 2024-08-13 10:25:44 +01:00
test_cext
test_concurrent_futures Fix typos in comments and test code (#122846) 2024-08-11 21:16:41 -07:00
test_cppext
test_ctypes gh-105733: Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. (GH-122281) 2024-07-30 09:37:58 +02:00
test_dataclasses
test_doctest
test_email Fix typos in comments and test code (#122846) 2024-08-11 21:16:41 -07:00
test_free_threading
test_future_stmt
test_gdb
test_import Fix typos in comments and test code (#122846) 2024-08-11 21:16:41 -07:00
test_importlib gh-116608: Apply style and compatibility changes from importlib_metadata. (#123028) 2024-08-15 15:32:05 -04:00
test_inspect gh-122087: Add tests for ismethoddescriptor() and isroutine() with partial objects (GH-122219) 2024-07-25 10:12:26 +03:00
test_interpreters
test_json gh-122873: Allow "python -m json" to work (#122884) 2024-08-13 17:09:38 +01:00
test_module
test_multiprocessing_fork
test_multiprocessing_forkserver
test_multiprocessing_spawn
test_pathlib GH-120754: Disable buffering in Path.read_bytes (#122111) 2024-08-16 13:52:41 -07:00
test_peg_generator
test_pydoc
test_pyrepl gh-87320: In the code module, handle exceptions raised in sys.excepthook (GH-122456) 2024-07-31 10:33:29 +00:00
test_sqlite3
test_tkinter
test_tomllib
test_tools
test_ttk
test_unittest gh-122858: Deprecate asyncio.iscoroutinefunction (#122875) 2024-08-11 16:35:51 +00:00
test_warnings gh-122255: Add black box tests in test_warnings (GH-122227) 2024-08-08 10:35:47 +03:00
test_zipfile gh-122903: Honor directories in zipfile.Path.glob. (#122908) 2024-08-11 20:33:33 -04:00
test_zoneinfo
tkinterdata
tokenizedata
tracedmodules
typinganndata
wheeldata
xmltestdata
zipimport_data
.ruff.toml
__init__.py
__main__.py
_test_atexit.py
_test_eintr.py
_test_embed_set_config.py
_test_embed_structseq.py gh-113190: Reenable non-debug interned string cleanup (GH-113601) 2024-08-15 11:55:09 +00:00
_test_monitoring_shutdown.py
_test_multiprocessing.py
_test_venv_multiprocessing.py
archiver_tests.py
audiotests.py
audit-tests.py
autotest.py
bisect_cmd.py
clinic.test.c gh-122688: Fix support of var-positional parameter in Argument Clinic (GH-122689) 2024-08-09 09:22:41 +00:00
cov.py
curses_tests.py
datetimetester.py gh-120782: Update datetime test for static type immutability (#122800) 2024-08-08 10:05:06 +05:30
dis_module.py
empty.vbs
exception_hierarchy.txt
fork_wait.py
levenshtein_examples.json
list_tests.py
lock_tests.py gh-121474: Add threading.Barrier parties arg sanity check. (GH-121480) 2024-07-30 11:53:07 +03:00
mapping_tests.py
memory_watchdog.py
mime.types
mock_socket.py
mp_fork_bomb.py
mp_preload.py
multibytecodec_support.py
pickletester.py gh-122459: Optimize pickling by name objects without __module__ (GH-122460) 2024-08-05 16:21:32 +03:00
profilee.py
pstats.pck
pyclbr_input.py
pythoninfo.py
randv2_32.pck
randv2_64.pck
randv3.pck
re_tests.py
regrtest.py
relimport.py
reperf.py
seq_tests.py
signalinterproctester.py
ssl_servers.py
ssltests.py
string_tests.py
test___all__.py
test__colorize.py
test__interpchannels.py
test__interpreters.py Fix typos in comments and docstring (#122720) 2024-08-07 07:39:16 +01:00
test__locale.py
test__opcode.py GH-122390: Replace _Py_GetbaseOpcode with _Py_GetBaseCodeUnit (GH-122942) 2024-08-13 14:22:57 +01:00
test__osx_support.py
test_abc.py
test_abstract_numbers.py
test_android.py gh-116622: Add Android test script (#121595) 2024-08-16 13:00:29 +08:00
test_annotationlib.py gh-119180: annotationlib: Fix __all__, formatting (#122365) 2024-08-11 23:44:51 +00:00
test_argparse.py gh-121151: argparse: Fix wrapping of long usage text of arguments inside a mutually exclusive groups (GH-121159) 2024-08-07 15:20:38 +02:00
test_array.py Fix typos in comments and docstring (#122720) 2024-08-07 07:39:16 +01:00
test_asdl_parser.py
test_asyncgen.py
test_atexit.py
test_audit.py
test_augassign.py
test_base64.py
test_baseexception.py
test_bdb.py
test_bigaddrspace.py
test_bigmem.py
test_binascii.py
test_binop.py
test_bisect.py
test_bool.py
test_buffer.py
test_bufio.py
test_builtin.py gh-116402: Avoid readline in test_builtin TTY input tests (GH-122447) 2024-07-30 16:57:19 +00:00
test_bytes.py
test_bz2.py
test_c_locale_coercion.py
test_calendar.py
test_call.py
test_charmapcodec.py
test_class.py
test_clinic.py gh-122688: Add more tests for var-positional parameters in Argument Clinic (GH-122900) 2024-08-12 16:52:48 +03:00
test_cmath.py
test_cmd.py
test_cmd_line.py
test_cmd_line_script.py
test_code.py
test_code_module.py gh-122478: Remove internal frames from tracebacks in REPL (GH-122528) 2024-08-07 23:20:57 +03:00
test_codeccallbacks.py
test_codecencodings_cn.py
test_codecencodings_hk.py
test_codecencodings_iso2022.py
test_codecencodings_jp.py
test_codecencodings_kr.py
test_codecencodings_tw.py
test_codecmaps_cn.py
test_codecmaps_hk.py
test_codecmaps_jp.py
test_codecmaps_kr.py
test_codecmaps_tw.py
test_codecs.py
test_codeop.py
test_collections.py
test_colorsys.py
test_compare.py
test_compile.py gh-122445: populate only modified fields in __static_attributes__ (#122446) 2024-08-02 15:40:42 +01:00
test_compileall.py
test_compiler_assemble.py
test_compiler_codegen.py
test_complex.py
test_configparser.py
test_contains.py
test_context.py
test_contextlib.py
test_contextlib_async.py
test_copy.py
test_copyreg.py
test_coroutines.py
test_cprofile.py
test_csv.py gh-113785: csv: fields starting with escapechar are not quoted (GH-122110) 2024-07-25 10:04:47 +03:00
test_curses.py
test_datetime.py
test_dbm.py
test_dbm_dumb.py
test_dbm_gnu.py
test_dbm_ndbm.py
test_dbm_sqlite3.py
test_decimal.py
test_decorators.py
test_defaultdict.py
test_deque.py
test_descr.py
test_descrtut.py
test_devpoll.py
test_dict.py
test_dict_version.py
test_dictcomps.py
test_dictviews.py
test_difflib.py
test_difflib_expect.html
test_dis.py GH-122390: Replace _Py_GetbaseOpcode with _Py_GetBaseCodeUnit (GH-122942) 2024-08-13 14:22:57 +01:00
test_docxmlrpc.py
test_dtrace.py
test_dynamic.py
test_dynamicclassattribute.py
test_eintr.py
test_embed.py gh-117482: Make the Slot Wrapper Inheritance Tests Much More Thorough (gh-122867) 2024-08-12 19:19:33 +00:00
test_ensurepip.py
test_enum.py
test_enumerate.py
test_eof.py
test_epoll.py
test_errno.py
test_except_star.py
test_exception_group.py
test_exception_hierarchy.py
test_exception_variations.py
test_exceptions.py
test_extcall.py
test_external_inspection.py
test_faulthandler.py
test_fcntl.py
test_file.py
test_file_eintr.py
test_filecmp.py gh-122400: Handle ValueError in filecmp (GH-122401) 2024-07-30 08:50:30 +00:00
test_fileinput.py
test_fileio.py
test_fileutils.py
test_finalization.py
test_float.py
test_flufl.py
test_fnmatch.py
test_fork1.py
test_format.py
test_fractions.py
test_frame.py gh-120906: Support arbitrary hashable keys in FrameLocalsProxy (GH-122309) 2024-07-30 22:11:00 +00:00
test_frozen.py
test_fstring.py
test_ftplib.py
test_funcattrs.py
test_functools.py
test_gc.py
test_generated_cases.py GH-120024: Remove CHECK_EVAL_BREAKER macro. (GH-122968) 2024-08-14 12:04:05 +01:00
test_generator_stop.py
test_generators.py
test_genericalias.py
test_genericclass.py
test_genericpath.py
test_genexps.py
test_getopt.py
test_getpass.py
test_getpath.py
test_gettext.py
test_glob.py
test_global.py
test_grammar.py
test_graphlib.py
test_grp.py
test_gzip.py
test_hash.py
test_hashlib.py gh-99108: Add HACL* Blake2 implementation to hashlib (GH-119316) 2024-08-13 21:42:19 +00:00
test_heapq.py
test_hmac.py
test_html.py
test_htmlparser.py
test_http_cookiejar.py
test_http_cookies.py
test_httplib.py
test_httpservers.py
test_idle.py
test_imaplib.py
test_index.py
test_int.py
test_int_literal.py
test_io.py
test_ioctl.py
test_ipaddress.py
test_isinstance.py
test_iter.py
test_iterlen.py
test_itertools.py
test_keyword.py
test_keywordonlyarg.py
test_kqueue.py
test_largefile.py GH-120754: Add more tests around seek + readall (#122103) 2024-07-23 23:14:35 -07:00
test_launcher.py
test_linecache.py gh-122170: Handle ValueError raised by os.stat() in linecache (GH-122176) 2024-07-27 10:10:42 +00:00
test_list.py
test_listcomps.py
test_lltrace.py
test_locale.py
test_logging.py GH-121723: Skip test_config_queue_handler_multiprocessing_context in emulated JIT CI (#122969) 2024-08-13 16:25:36 -07:00
test_long.py
test_longexp.py
test_lzma.py
test_mailbox.py
test_marshal.py
test_math.py
test_math_property.py
test_memoryio.py
test_memoryview.py
test_metaclass.py
test_mimetypes.py
test_minidom.py
test_mmap.py
test_modulefinder.py
test_monitoring.py GH-122821: Simplify compilation of while statements to ensure consistency of offsets for sys.monitoring (GH-122934) 2024-08-13 10:25:44 +01:00
test_msvcrt.py
test_multibytecodec.py
test_multiprocessing_main_handling.py
test_named_expressions.py
test_netrc.py
test_ntpath.py
test_numeric_tower.py
test_opcache.py
test_opcodes.py
test_openpty.py
test_operator.py gh-115808: Add `is_none and is_not_none to operator` (#115814) 2024-08-10 20:16:34 +01:00
test_optimizer.py
test_optparse.py
test_ordered_dict.py
test_os.py
test_osx_env.py
test_patma.py
test_pdb.py
test_peepholer.py
test_pep646_syntax.py
test_perf_profiler.py
test_perfmaps.py
test_pickle.py gh-122311: Add more tests for pickle (GH-122376) 2024-07-28 11:33:17 +03:00
test_picklebuffer.py
test_pickletools.py
test_pkg.py
test_pkgutil.py
test_platform.py
test_plistlib.py
test_poll.py
test_popen.py
test_poplib.py
test_positional_only_arg.py
test_posix.py
test_posixpath.py gh-116622: Skip PosixPathTest.test_expanduser_pwd2 on platforms which don't support pwd.getpwall (GH-122521) 2024-07-31 21:35:10 +03:00
test_pow.py
test_pprint.py
test_print.py Remove "print >>obj" exception hint for Python 2 (#122853) 2024-08-12 04:12:14 +00:00
test_profile.py
test_property.py
test_pstats.py
test_pty.py
test_pulldom.py
test_pwd.py
test_py_compile.py
test_pyclbr.py
test_pyexpat.py
test_queue.py
test_quopri.py
test_raise.py
test_random.py
test_range.py
test_re.py gh-122798: Make tests for warnings in the re module more strict (GH-122799) 2024-08-07 19:43:49 +00:00
test_readline.py
test_regrtest.py
test_repl.py
test_reprlib.py
test_resource.py
test_richcmp.py
test_rlcompleter.py
test_robotparser.py
test_runpy.py
test_sax.py
test_sched.py
test_scope.py
test_script_helper.py
test_secrets.py
test_select.py
test_selectors.py
test_set.py
test_setcomps.py
test_shelve.py
test_shlex.py
test_shutil.py gh-121999: Change default tarfile filter to 'data' (GH-122002) 2024-07-26 16:34:13 +02:00
test_signal.py
test_site.py
test_slice.py
test_smtplib.py
test_smtpnet.py
test_socket.py gh-122133: Rework pure Python socketpair tests to avoid use of importlib.reload. (#122493) 2024-07-31 10:24:15 +02:00
test_socketserver.py
test_sort.py
test_source_encoding.py
test_ssl.py gh-118658: Return consistent types from get_un/verified_chain in SSLObject and SSLSocket (#118669) 2024-08-16 22:27:44 +02:00
test_stable_abi_ctypes.py gh-105201: Add PyIter_NextItem() (#122331) 2024-08-08 00:47:15 +02:00
test_startfile.py
test_stat.py
test_statistics.py
test_str.py gh-122888: Fix crash on certain calls to str() (#122889) 2024-08-12 09:20:09 -07:00
test_strftime.py
test_string.py
test_string_literals.py
test_stringprep.py
test_strptime.py
test_strtod.py
test_struct.py
test_structseq.py gh-122527: Fix a crash on deallocation of PyStructSequence (GH-122577) 2024-08-02 18:11:44 +02:00
test_subclassinit.py
test_subprocess.py gh-121381 Remove subprocess._USE_VFORK escape hatch (#121383) 2024-07-30 18:39:54 -07:00
test_sundry.py
test_super.py
test_support.py
test_symtable.py gh-122560: add test that comprehension loop var appears only in one scope of the symtable (#122582) 2024-08-02 23:56:51 +01:00
test_syntax.py gh-122245: Add test case of generic type with __debug__ (#122322) 2024-07-26 18:40:36 +00:00
test_sys.py gh-122417: Implement per-thread heap type refcounts (#122418) 2024-08-06 14:36:57 -04:00
test_sys_setprofile.py gh-122029: Log call events in sys.setprofile when it's a method with c function (GH-122072) 2024-07-23 15:25:26 -07:00
test_sys_settrace.py GH-121131: Clean up and fix some instrumented instructions. (GH-121132) 2024-07-26 12:24:12 +01:00
test_sysconfig.py
test_syslog.py
test_tabnanny.py
test_tarfile.py gh-121999: Change default tarfile filter to 'data' (GH-122002) 2024-07-26 16:34:13 +02:00
test_tcl.py
test_tempfile.py
test_termios.py
test_textwrap.py
test_thread.py
test_threadedtempfile.py
test_threading.py
test_threading_local.py
test_threadsignals.py
test_time.py
test_timeit.py
test_timeout.py
test_tokenize.py
test_trace.py
test_traceback.py
test_tracemalloc.py
test_ttk_textonly.py
test_tty.py
test_tuple.py
test_turtle.py
test_type_aliases.py
test_type_annotations.py
test_type_cache.py GH-121832: Assert that the version number of static builtin types is not changed by PyType_Modified. (GH-122182) 2024-07-24 10:22:51 +01:00
test_type_comments.py
test_type_params.py gh-119180: Add evaluate functions for type params and type aliases (#122212) 2024-07-27 17:24:10 +00:00
test_typechecks.py
test_types.py gh-117482: Make the Slot Wrapper Inheritance Tests Much More Thorough (gh-122867) 2024-08-12 19:19:33 +00:00
test_typing.py gh-122835: Fix module name in `test_typing` (#122836) 2024-08-08 19:26:31 +00:00
test_ucn.py
test_unary.py
test_unicode_file.py
test_unicode_file_functions.py
test_unicode_identifiers.py
test_unicodedata.py
test_univnewlines.py
test_unpack.py
test_unpack_ex.py
test_unparse.py
test_urllib.py
test_urllib2.py
test_urllib2_localnet.py
test_urllib2net.py
test_urllib_response.py
test_urllibnet.py
test_urlparse.py
test_userdict.py
test_userlist.py
test_userstring.py
test_utf8_mode.py
test_utf8source.py
test_uuid.py
test_venv.py gh-122744: test_venv: ignore pip's complaint about missing ssl (GH-122776) 2024-08-08 11:20:58 +02:00
test_wait3.py
test_wait4.py
test_wave.py
test_weakref.py gh-123046: Fix regexp to catch cases where the module name is omitted from the weakref repr (#123047) 2024-08-16 07:14:53 +00:00
test_weakset.py
test_webbrowser.py Fix typos in docs, error messages and comments (#122502) 2024-08-01 00:26:09 +00:00
test_winapi.py
test_winconsoleio.py
test_winreg.py
test_winsound.py
test_with.py
test_wmi.py
test_wsgiref.py
test_xml_dom_minicompat.py
test_xml_etree.py
test_xml_etree_c.py
test_xmlrpc.py
test_xxlimited.py
test_xxtestfuzz.py
test_yield_from.py
test_zipapp.py
test_zipfile64.py
test_zipimport.py
test_zipimport_support.py
test_zlib.py
testcodec.py
tf_inherit_check.py
win_console_handler.py
xmltests.py