3
0
Fork 0

Tweak docs for FileConfigTestCase

This commit is contained in:
Lance Edgar 2023-11-22 21:48:18 -06:00
parent af4c28b286
commit 8759fb8d37

View file

@ -32,15 +32,15 @@ from unittest import TestCase
class FileConfigTestCase(TestCase):
"""
Common base class for test suites which write temporary config
files, for sake of testing the config constructor etc.
Common base class for test suites which write temporary files, for
sake of testing the config constructor etc.
This inherits from :class:`python:unittest.TestCase` and adds the
following features:
Creates a temporary folder on setup, and removes it on teardown.
Adds the :meth:`write_file()` method to help with creating
temporary config files etc.
temporary files.
.. attribute:: tempdir
@ -48,6 +48,7 @@ class FileConfigTestCase(TestCase):
"""
def setUp(self):
""" """
self.setup_file_config()
def setup_file_config(self):
@ -59,6 +60,7 @@ class FileConfigTestCase(TestCase):
self.tempdir = tempfile.mkdtemp()
def tearDown(self):
""" """
self.teardown_file_config()
def teardown_file_config(self):
@ -74,7 +76,7 @@ class FileConfigTestCase(TestCase):
Write a new file (in temporary folder) with the given filename
and content, and return its full path. For instance::
myfilepath = self.write_file('my.conf', '<file contents>')
myconf = self.write_file('my.conf', '<file contents>')
"""
path = os.path.join(self.tempdir, filename)
with open(path, 'wt') as f: