[Python-checkins] bpo-44514: Add doctest testcleanup for configparser and bz2 (GH-26909) (GH-27112)
ambv
webhook-mailer at python.org
Tue Jul 13 10:34:15 EDT 2021
https://github.com/python/cpython/commit/f514addfbc637a42549ddc422b35b6caad2a4363
commit: f514addfbc637a42549ddc422b35b6caad2a4363
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-07-13T16:34:10+02:00
summary:
bpo-44514: Add doctest testcleanup for configparser and bz2 (GH-26909) (GH-27112)
Add testcleanup section to configparser and bz2 documentation which
removes temporary files created in the filesystem when 'make doctest'
is run.
(cherry picked from commit 48a5aa7f128caf5a46e4326c1fd285cd5fc8e59d)
Co-authored-by: Kevin Follstad <kfollstad at gmail.com>
files:
M Doc/library/bz2.rst
M Doc/library/configparser.rst
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index f6787ab120ed5..999892e95f471 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -325,3 +325,8 @@ Writing and reading a bzip2-compressed file in binary mode:
... content = f.read()
>>> content == data # Check equality to original object after round-trip
True
+
+.. testcleanup::
+
+ import os
+ os.remove("myfile.bz2")
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst
index b0c2a2cfb06a4..2bb425930bba7 100644
--- a/Doc/library/configparser.rst
+++ b/Doc/library/configparser.rst
@@ -46,6 +46,11 @@ can be customized by end users easily.
import configparser
+.. testcleanup::
+
+ import os
+ os.remove("example.ini")
+
Quick Start
-----------
More information about the Python-checkins
mailing list