]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-108303: Move config parser data to `Lib/test/configparserdata/` (gh-111879)
authorNikita Sobolev <mail@sobolevn.me>
Thu, 9 Nov 2023 13:52:32 +0000 (16:52 +0300)
committerGitHub <noreply@github.com>
Thu, 9 Nov 2023 13:52:32 +0000 (14:52 +0100)
Lib/idlelib/idle_test/test_config.py
Lib/test/configdata/cfgparser.1 [moved from Lib/test/cfgparser.1 with 100% similarity]
Lib/test/configdata/cfgparser.2 [moved from Lib/test/cfgparser.2 with 100% similarity]
Lib/test/configdata/cfgparser.3 [moved from Lib/test/cfgparser.3 with 100% similarity]
Lib/test/test_configparser.py

index a746f1538a62b00f57bb05b75d37ea566546c05c..6d75cf7aa67dcce3b9bc49cc54cb4d5fd24cc103 100644 (file)
@@ -85,8 +85,8 @@ class IdleConfParserTest(unittest.TestCase):
         self.assertEqual(parser.sections(), [])
 
     def test_load_file(self):
-        # Borrow test/cfgparser.1 from test_configparser.
-        config_path = findfile('cfgparser.1')
+        # Borrow test/configdata/cfgparser.1 from test_configparser.
+        config_path = findfile('cfgparser.1', subdir='configdata')
         parser = config.IdleConfParser(config_path)
         parser.Load()
 
@@ -294,8 +294,8 @@ class IdleConfTest(unittest.TestCase):
     def test_load_cfg_files(self):
         conf = self.new_config(_utest=True)
 
-        # Borrow test/cfgparser.1 from test_configparser.
-        config_path = findfile('cfgparser.1')
+        # Borrow test/configdata/cfgparser.1 from test_configparser.
+        config_path = findfile('cfgparser.1', subdir='configdata')
         conf.defaultCfg['foo'] = config.IdleConfParser(config_path)
         conf.userCfg['foo'] = config.IdleUserConfParser(config_path)
 
index 53163d7528b64a54c4481562caf11baf651a3783..2d7dfbde7082ee352b1442e146cb2ff063d83792 100644 (file)
@@ -543,7 +543,7 @@ boolean {0[0]} NO
                                 "[Foo]\n  wrong-indent\n")
             self.assertEqual(e.args, ('<???>',))
             # read_file on a real file
-            tricky = support.findfile("cfgparser.3")
+            tricky = support.findfile("cfgparser.3", subdir="configdata")
             if self.delimiters[0] == '=':
                 error = configparser.ParsingError
                 expected = (tricky,)
@@ -717,7 +717,7 @@ boolean {0[0]} NO
     def test_read_returns_file_list(self):
         if self.delimiters[0] != '=':
             self.skipTest('incompatible format')
-        file1 = support.findfile("cfgparser.1")
+        file1 = support.findfile("cfgparser.1", subdir="configdata")
         # check when we pass a mix of readable and non-readable files:
         cf = self.newconfig()
         parsed_files = cf.read([file1, "nonexistent-file"], encoding="utf-8")
@@ -750,7 +750,7 @@ boolean {0[0]} NO
     def test_read_returns_file_list_with_bytestring_path(self):
         if self.delimiters[0] != '=':
             self.skipTest('incompatible format')
-        file1_bytestring = support.findfile("cfgparser.1").encode()
+        file1_bytestring = support.findfile("cfgparser.1", subdir="configdata").encode()
         # check when passing an existing bytestring path
         cf = self.newconfig()
         parsed_files = cf.read(file1_bytestring, encoding="utf-8")
@@ -1126,7 +1126,7 @@ class RawConfigParserTestSambaConf(CfgParserTestCaseClass, unittest.TestCase):
     empty_lines_in_values = False
 
     def test_reading(self):
-        smbconf = support.findfile("cfgparser.2")
+        smbconf = support.findfile("cfgparser.2", subdir="configdata")
         # check when we pass a mix of readable and non-readable files:
         cf = self.newconfig()
         parsed_files = cf.read([smbconf, "nonexistent-file"], encoding='utf-8')
@@ -1321,7 +1321,7 @@ class ConfigParserTestCaseTrickyFile(CfgParserTestCaseClass, unittest.TestCase):
     allow_no_value = True
 
     def test_cfgparser_dot_3(self):
-        tricky = support.findfile("cfgparser.3")
+        tricky = support.findfile("cfgparser.3", subdir="configdata")
         cf = self.newconfig()
         self.assertEqual(len(cf.read(tricky, encoding='utf-8')), 1)
         self.assertEqual(cf.sections(), ['strange',
@@ -1353,7 +1353,7 @@ class ConfigParserTestCaseTrickyFile(CfgParserTestCaseClass, unittest.TestCase):
         self.assertEqual(cf.get('more interpolation', 'lets'), 'go shopping')
 
     def test_unicode_failure(self):
-        tricky = support.findfile("cfgparser.3")
+        tricky = support.findfile("cfgparser.3", subdir="configdata")
         cf = self.newconfig()
         with self.assertRaises(UnicodeDecodeError):
             cf.read(tricky, encoding='ascii')
@@ -1454,7 +1454,7 @@ class CopyTestCase(BasicTestCase, unittest.TestCase):
 
 class FakeFile:
     def __init__(self):
-        file_path = support.findfile("cfgparser.1")
+        file_path = support.findfile("cfgparser.1", subdir="configdata")
         with open(file_path, encoding="utf-8") as f:
             self.lines = f.readlines()
             self.lines.reverse()
@@ -1475,7 +1475,7 @@ def readline_generator(f):
 
 class ReadFileTestCase(unittest.TestCase):
     def test_file(self):
-        file_paths = [support.findfile("cfgparser.1")]
+        file_paths = [support.findfile("cfgparser.1", subdir="configdata")]
         try:
             file_paths.append(file_paths[0].encode('utf8'))
         except UnicodeEncodeError: