Add missing type hints to tests.config. (#14681)

This commit is contained in:
Patrick Cloke 2022-12-16 08:53:28 -05:00 committed by GitHub
parent 864c3f85b0
commit 3aeca2588b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 108 additions and 103 deletions

View file

@ -24,13 +24,13 @@ from tests import unittest
class BaseConfigTestCase(unittest.TestCase):
def setUp(self):
def setUp(self) -> None:
# The root object needs a server property with a public_baseurl.
root = Mock()
root.server.public_baseurl = "http://test"
self.config = Config(root)
def test_loading_missing_templates(self):
def test_loading_missing_templates(self) -> None:
# Use a temporary directory that exists on the system, but that isn't likely to
# contain template files
with tempfile.TemporaryDirectory() as tmp_dir:
@ -50,7 +50,7 @@ class BaseConfigTestCase(unittest.TestCase):
"Template file did not contain our test string",
)
def test_loading_custom_templates(self):
def test_loading_custom_templates(self) -> None:
# Use a temporary directory that exists on the system
with tempfile.TemporaryDirectory() as tmp_dir:
# Create a temporary bogus template file
@ -79,7 +79,7 @@ class BaseConfigTestCase(unittest.TestCase):
"Template file did not contain our test string",
)
def test_multiple_custom_template_directories(self):
def test_multiple_custom_template_directories(self) -> None:
"""Tests that directories are searched in the right order if multiple custom
template directories are provided.
"""
@ -137,7 +137,7 @@ class BaseConfigTestCase(unittest.TestCase):
for td in tempdirs:
td.cleanup()
def test_loading_template_from_nonexistent_custom_directory(self):
def test_loading_template_from_nonexistent_custom_directory(self) -> None:
with self.assertRaises(ConfigError):
self.config.read_templates(
["some_filename.html"], ("a_nonexistent_directory",)