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