Skip to content

[3.12] gh-108303: Move config parser data to Lib/test/configparserdata/ (gh-111879) #111882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Lib/idlelib/idle_test/test_config.py
Original file line number Diff line number Diff line change
@@ -85,8 +85,8 @@ def test_load_nothing(self):
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 @@ def test_create_config_handlers(self):
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)

File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions Lib/test/test_configparser.py
Original file line number Diff line number Diff line change
@@ -544,7 +544,7 @@ def test_parse_errors(self):
"[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 @@ class mystr(str):
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 @@ def test_read_returns_file_list(self):
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 @@ def test_cfgparser_dot_3(self):
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 @@ def fromstring(self, string, defaults=None):

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: