Skip to content

Commit abe8254

Browse files
committed
fix: _exit is a better name for the patch than os._exit
1 parent dec0e84 commit abe8254

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Unreleased
3333

3434
- A new configuration option: ":ref:`config_run_patch`" lets you
3535
specify named patches to apply to work around some limitations in coverage
36-
measurement. As of now, there is only one patch: ``os._exit`` lets coverage
36+
measurement. As of now, there is only one patch: ``_exit`` lets coverage
3737
save its data even when :func:`os._exit() <python:os._exit>` is used to
3838
abruptly end the process. This closes long-standing `issue 310`_ as well as
3939
its duplicates: `issue 312`_, `issue 1845`_, and `issue 1941`_.

coverage/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def apply_patches(cov: Coverage, config: CoverageConfig) -> None:
2121
"""Apply invasive patches requested by `[run] patch=`."""
2222

2323
for patch in set(config.patch):
24-
if patch == "os._exit":
24+
if patch == "_exit":
2525
def _coverage_os_exit_patch(status: int) -> NoReturn:
2626
try:
2727
cov.save()

doc/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ side-effects.
443443

444444
Currently there is only one available patch:
445445

446-
- ``os._exit``: The :func:`os._exit() <python:os._exit>` function exits the
446+
- ``_exit``: The :func:`os._exit() <python:os._exit>` function exits the
447447
process immediately without calling cleanup handlers. This patch saves
448448
coverage data before exiting.
449449

tests/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def test_unknown_patch(self) -> None:
474474
self.make_file(".coveragerc", """\
475475
[run]
476476
patch =
477-
os._exit
477+
_exit
478478
xyzzy
479479
""")
480480
msg = "Unknown patch 'xyzzy'"

tests/test_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def test_os_exit(self, patch: bool) -> None:
447447
""")
448448
total_lines = 17
449449
if patch:
450-
self.make_file(".coveragerc", "[run]\npatch = os._exit\n")
450+
self.make_file(".coveragerc", "[run]\npatch = _exit\n")
451451
self.run_command("coverage run -p forky.py")
452452
self.run_command("coverage combine")
453453
data = coverage.CoverageData()

0 commit comments

Comments
 (0)