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 409a0ac

Browse filesBrowse files
[3.11] gh-108303: Move config parser data to Lib/test/configparserdata/ (gh-111879) (gh-111883)
gh-108303: Move config parser data to `Lib/test/configparserdata/` (gh-111879) (cherry picked from commit cc18b88) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent a60bbde commit 409a0ac
Copy full SHA for 409a0ac

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
@@ -544,7 +544,7 @@ def test_parse_errors(self):
544544
"[Foo]\n wrong-indent\n")
545545
self.assertEqual(e.args, ('<???>',))
546546
# read_file on a real file
547-
tricky = support.findfile("cfgparser.3")
547+
tricky = support.findfile("cfgparser.3", subdir="configdata")
548548
if self.delimiters[0] == '=':
549549
error = configparser.ParsingError
550550
expected = (tricky,)
@@ -718,7 +718,7 @@ class mystr(str):
718718
def test_read_returns_file_list(self):
719719
if self.delimiters[0] != '=':
720720
self.skipTest('incompatible format')
721-
file1 = support.findfile("cfgparser.1")
721+
file1 = support.findfile("cfgparser.1", subdir="configdata")
722722
# check when we pass a mix of readable and non-readable files:
723723
cf = self.newconfig()
724724
parsed_files = cf.read([file1, "nonexistent-file"], encoding="utf-8")
@@ -751,7 +751,7 @@ def test_read_returns_file_list(self):
751751
def test_read_returns_file_list_with_bytestring_path(self):
752752
if self.delimiters[0] != '=':
753753
self.skipTest('incompatible format')
754-
file1_bytestring = support.findfile("cfgparser.1").encode()
754+
file1_bytestring = support.findfile("cfgparser.1", subdir="configdata").encode()
755755
# check when passing an existing bytestring path
756756
cf = self.newconfig()
757757
parsed_files = cf.read(file1_bytestring, encoding="utf-8")
@@ -1161,7 +1161,7 @@ class RawConfigParserTestSambaConf(CfgParserTestCaseClass, unittest.TestCase):
11611161
empty_lines_in_values = False
11621162

11631163
def test_reading(self):
1164-
smbconf = support.findfile("cfgparser.2")
1164+
smbconf = support.findfile("cfgparser.2", subdir="configdata")
11651165
# check when we pass a mix of readable and non-readable files:
11661166
cf = self.newconfig()
11671167
parsed_files = cf.read([smbconf, "nonexistent-file"], encoding='utf-8')
@@ -1356,7 +1356,7 @@ class ConfigParserTestCaseTrickyFile(CfgParserTestCaseClass, unittest.TestCase):
13561356
allow_no_value = True
13571357

13581358
def test_cfgparser_dot_3(self):
1359-
tricky = support.findfile("cfgparser.3")
1359+
tricky = support.findfile("cfgparser.3", subdir="configdata")
13601360
cf = self.newconfig()
13611361
self.assertEqual(len(cf.read(tricky, encoding='utf-8')), 1)
13621362
self.assertEqual(cf.sections(), ['strange',
@@ -1388,7 +1388,7 @@ def test_cfgparser_dot_3(self):
13881388
self.assertEqual(cf.get('more interpolation', 'lets'), 'go shopping')
13891389

13901390
def test_unicode_failure(self):
1391-
tricky = support.findfile("cfgparser.3")
1391+
tricky = support.findfile("cfgparser.3", subdir="configdata")
13921392
cf = self.newconfig()
13931393
with self.assertRaises(UnicodeDecodeError):
13941394
cf.read(tricky, encoding='ascii')
@@ -1489,7 +1489,7 @@ def fromstring(self, string, defaults=None):
14891489

14901490
class FakeFile:
14911491
def __init__(self):
1492-
file_path = support.findfile("cfgparser.1")
1492+
file_path = support.findfile("cfgparser.1", subdir="configdata")
14931493
with open(file_path, encoding="utf-8") as f:
14941494
self.lines = f.readlines()
14951495
self.lines.reverse()
@@ -1510,7 +1510,7 @@ def readline_generator(f):
15101510

15111511
class ReadFileTestCase(unittest.TestCase):
15121512
def test_file(self):
1513-
file_paths = [support.findfile("cfgparser.1")]
1513+
file_paths = [support.findfile("cfgparser.1", subdir="configdata")]
15141514
try:
15151515
file_paths.append(file_paths[0].encode('utf8'))
15161516
except UnicodeEncodeError:

0 commit comments

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