Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cc18b88

Browse filesBrowse files
authored
gh-108303: Move config parser data to Lib/test/configparserdata/ (gh-111879)
1 parent 34a03e9 commit cc18b88
Copy full SHA for cc18b88

File tree

5 files changed

+12
-12
lines changed
Filter options

5 files changed

+12
-12
lines changed

‎Lib/idlelib/idle_test/test_config.py

Copy file name to clipboardExpand all lines: Lib/idlelib/idle_test/test_config.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def test_load_nothing(self):
8585
self.assertEqual(parser.sections(), [])
8686

8787
def test_load_file(self):
88-
# Borrow test/cfgparser.1 from test_configparser.
89-
config_path = findfile('cfgparser.1')
88+
# Borrow test/configdata/cfgparser.1 from test_configparser.
89+
config_path = findfile('cfgparser.1', subdir='configdata')
9090
parser = config.IdleConfParser(config_path)
9191
parser.Load()
9292

@@ -294,8 +294,8 @@ def test_create_config_handlers(self):
294294
def test_load_cfg_files(self):
295295
conf = self.new_config(_utest=True)
296296

297-
# Borrow test/cfgparser.1 from test_configparser.
298-
config_path = findfile('cfgparser.1')
297+
# Borrow test/configdata/cfgparser.1 from test_configparser.
298+
config_path = findfile('cfgparser.1', subdir='configdata')
299299
conf.defaultCfg['foo'] = config.IdleConfParser(config_path)
300300
conf.userCfg['foo'] = config.IdleUserConfParser(config_path)
301301

File renamed without changes.
File renamed without changes.
File renamed without changes.

‎Lib/test/test_configparser.py

Copy file name to clipboardExpand all lines: Lib/test/test_configparser.py
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def test_parse_errors(self):
543543
"[Foo]\n wrong-indent\n")
544544
self.assertEqual(e.args, ('<???>',))
545545
# read_file on a real file
546-
tricky = support.findfile("cfgparser.3")
546+
tricky = support.findfile("cfgparser.3", subdir="configdata")
547547
if self.delimiters[0] == '=':
548548
error = configparser.ParsingError
549549
expected = (tricky,)
@@ -717,7 +717,7 @@ class mystr(str):
717717
def test_read_returns_file_list(self):
718718
if self.delimiters[0] != '=':
719719
self.skipTest('incompatible format')
720-
file1 = support.findfile("cfgparser.1")
720+
file1 = support.findfile("cfgparser.1", subdir="configdata")
721721
# check when we pass a mix of readable and non-readable files:
722722
cf = self.newconfig()
723723
parsed_files = cf.read([file1, "nonexistent-file"], encoding="utf-8")
@@ -750,7 +750,7 @@ def test_read_returns_file_list(self):
750750
def test_read_returns_file_list_with_bytestring_path(self):
751751
if self.delimiters[0] != '=':
752752
self.skipTest('incompatible format')
753-
file1_bytestring = support.findfile("cfgparser.1").encode()
753+
file1_bytestring = support.findfile("cfgparser.1", subdir="configdata").encode()
754754
# check when passing an existing bytestring path
755755
cf = self.newconfig()
756756
parsed_files = cf.read(file1_bytestring, encoding="utf-8")
@@ -1126,7 +1126,7 @@ class RawConfigParserTestSambaConf(CfgParserTestCaseClass, unittest.TestCase):
11261126
empty_lines_in_values = False
11271127

11281128
def test_reading(self):
1129-
smbconf = support.findfile("cfgparser.2")
1129+
smbconf = support.findfile("cfgparser.2", subdir="configdata")
11301130
# check when we pass a mix of readable and non-readable files:
11311131
cf = self.newconfig()
11321132
parsed_files = cf.read([smbconf, "nonexistent-file"], encoding='utf-8')
@@ -1321,7 +1321,7 @@ class ConfigParserTestCaseTrickyFile(CfgParserTestCaseClass, unittest.TestCase):
13211321
allow_no_value = True
13221322

13231323
def test_cfgparser_dot_3(self):
1324-
tricky = support.findfile("cfgparser.3")
1324+
tricky = support.findfile("cfgparser.3", subdir="configdata")
13251325
cf = self.newconfig()
13261326
self.assertEqual(len(cf.read(tricky, encoding='utf-8')), 1)
13271327
self.assertEqual(cf.sections(), ['strange',
@@ -1353,7 +1353,7 @@ def test_cfgparser_dot_3(self):
13531353
self.assertEqual(cf.get('more interpolation', 'lets'), 'go shopping')
13541354

13551355
def test_unicode_failure(self):
1356-
tricky = support.findfile("cfgparser.3")
1356+
tricky = support.findfile("cfgparser.3", subdir="configdata")
13571357
cf = self.newconfig()
13581358
with self.assertRaises(UnicodeDecodeError):
13591359
cf.read(tricky, encoding='ascii')
@@ -1454,7 +1454,7 @@ def fromstring(self, string, defaults=None):
14541454

14551455
class FakeFile:
14561456
def __init__(self):
1457-
file_path = support.findfile("cfgparser.1")
1457+
file_path = support.findfile("cfgparser.1", subdir="configdata")
14581458
with open(file_path, encoding="utf-8") as f:
14591459
self.lines = f.readlines()
14601460
self.lines.reverse()
@@ -1475,7 +1475,7 @@ def readline_generator(f):
14751475

14761476
class ReadFileTestCase(unittest.TestCase):
14771477
def test_file(self):
1478-
file_paths = [support.findfile("cfgparser.1")]
1478+
file_paths = [support.findfile("cfgparser.1", subdir="configdata")]
14791479
try:
14801480
file_paths.append(file_paths[0].encode('utf8'))
14811481
except UnicodeEncodeError:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.