summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-11-09 14:41:44 (GMT)
committerGitHub <noreply@github.com>2023-11-09 14:41:44 (GMT)
commite11ea5a400ba1d52e948d50925f52ed664fd74b8 (patch)
tree13e3c41d49e33c86d437e133d30ede1d84680288
parent4f976c3b9a6b3606c12924a1adadd12f9d5f0388 (diff)
downloadcpython-e11ea5a400ba1d52e948d50925f52ed664fd74b8.zip
cpython-e11ea5a400ba1d52e948d50925f52ed664fd74b8.tar.gz
cpython-e11ea5a400ba1d52e948d50925f52ed664fd74b8.tar.bz2
[3.12] gh-108303: Move config parser data to `Lib/test/configparserdata/` (gh-111879) (gh-111882)
gh-108303: Move config parser data to `Lib/test/configparserdata/` (gh-111879) (cherry picked from commit cc18b886a51672c59622837a2b8e83bf6be28c58) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r--Lib/idlelib/idle_test/test_config.py8
-rw-r--r--Lib/test/configdata/cfgparser.1 (renamed from Lib/test/cfgparser.1)0
-rw-r--r--Lib/test/configdata/cfgparser.2 (renamed from Lib/test/cfgparser.2)0
-rw-r--r--Lib/test/configdata/cfgparser.3 (renamed from Lib/test/cfgparser.3)0
-rw-r--r--Lib/test/test_configparser.py16
5 files changed, 12 insertions, 12 deletions
diff --git a/Lib/idlelib/idle_test/test_config.py b/Lib/idlelib/idle_test/test_config.py
index a746f15..6d75cf7 100644
--- a/Lib/idlelib/idle_test/test_config.py
+++ b/Lib/idlelib/idle_test/test_config.py
@@ -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)
diff --git a/Lib/test/cfgparser.1 b/Lib/test/configdata/cfgparser.1
index 0c0e0d3..0c0e0d3 100644
--- a/Lib/test/cfgparser.1
+++ b/Lib/test/configdata/cfgparser.1
diff --git a/Lib/test/cfgparser.2 b/Lib/test/configdata/cfgparser.2
index cfcfef2..cfcfef2 100644
--- a/Lib/test/cfgparser.2
+++ b/Lib/test/configdata/cfgparser.2
diff --git a/Lib/test/cfgparser.3 b/Lib/test/configdata/cfgparser.3
index c182cd7..c182cd7 100644
--- a/Lib/test/cfgparser.3
+++ b/Lib/test/configdata/cfgparser.3
diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py
index da17c00..14e4a2c 100644
--- a/Lib/test/test_configparser.py
+++ b/Lib/test/test_configparser.py
@@ -544,7 +544,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,)
@@ -718,7 +718,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")
@@ -751,7 +751,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")
@@ -1161,7 +1161,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')
@@ -1356,7 +1356,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',
@@ -1388,7 +1388,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')
@@ -1489,7 +1489,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()
@@ -1510,7 +1510,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: