gh-103606: raise RuntimeError if config file is invalid or empty (#104701)

(this adjusts new code) raise RuntimeError if provided config file is invalid or empty, not ValueError.
This commit is contained in:
Prince Roshan 2023-05-21 03:56:49 +05:30 committed by GitHub
parent 27a68be77f
commit 12f1581b0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -1781,12 +1781,12 @@ class ConfigFileTest(BaseTest):
"""
file = io.StringIO(textwrap.dedent(test_config))
self.assertRaises(ValueError, logging.config.fileConfig, file)
self.assertRaises(RuntimeError, logging.config.fileConfig, file)
def test_exception_if_confg_file_is_empty(self):
fd, fn = tempfile.mkstemp(prefix='test_empty_', suffix='.ini')
os.close(fd)
self.assertRaises(ValueError, logging.config.fileConfig, fn)
self.assertRaises(RuntimeError, logging.config.fileConfig, fn)
os.remove(fn)
def test_exception_if_config_file_does_not_exist(self):