Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix CI
  • Loading branch information
sobolevn committed Feb 14, 2024
commit 24fd790911a2c7af4bd4ecd81ef0441c15655a2c
2 changes: 1 addition & 1 deletion Lib/test/test_idle/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def setUpClass(cls):
cls.config_string = {}

conf = config.IdleConf(_utest=True)
idle_dir = os.path.abspath(idlelib.__file__)
idle_dir = os.path.abspath(os.path.dirname(idlelib.__file__))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all these test file changes make them independent of test file location. If so, they can be done now without moving the files. It would be easy to find out. Some of these look like improvements in any case. I would add a note to idle_test.README.txt that tests should not depend on being in idle_test.

for ctype in conf.config_types:
config_path = os.path.join(idle_dir, '../config-%s.def' % ctype)
with open(config_path) as f:
Expand Down
10 changes: 6 additions & 4 deletions Lib/test/test_idle/test_grep.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ def test_base(self):
'idlelib',
'idle_test',
)
htest = os.path.join(idle_test_root, 'htest.py')
readme = os.path.join(idle_test_root, 'README.txt')

# Check for Python files in path where this file lives.
python_files = list(ff(idle_test_root, '*.py', False))
# This directory has many Python files.
self.assertGreaterEqual(len(python_files), 5)
self.assertIn(self.realpath, python_files)
self.assertIn(htest, python_files)
self.assertNotIn(readme, python_files)

# Look for .txt files in path where this file lives.
Expand All @@ -99,6 +100,7 @@ def test_recurse(self):
'idlelib',
)
grepfile = os.path.join(parent, 'grep.py')
htest = os.path.join(parent, 'idle_test', 'htest.py')
pat = '*.py'

# Get Python files only in parent directory.
Expand All @@ -108,20 +110,20 @@ def test_recurse(self):
self.assertGreater(parent_size, 20)
self.assertIn(grepfile, filelist)
# Without subdirectories, this file isn't returned.
self.assertNotIn(self.realpath, filelist)
self.assertNotIn(htest, filelist)

# Include subdirectories.
filelist = list(ff(parent, pat, True))
# More files found now.
self.assertGreater(len(filelist), parent_size)
self.assertIn(grepfile, filelist)
# This file exists in list now.
self.assertIn(self.realpath, filelist)
self.assertIn(htest, filelist)

# Check another level up the tree.
parent = os.path.dirname(parent)
filelist = list(ff(parent, '*.py', True))
self.assertIn(self.realpath, filelist)
self.assertIn(htest, filelist)


class Grep_itTest(unittest.TestCase):
Expand Down