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 998374a28444e419f54f3283a80cdd318356aa27
5 changes: 1 addition & 4 deletions Lib/test/test_idle/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ def setUpClass(cls):
cls.config_string = {}

conf = config.IdleConf(_utest=True)
if __name__ != '__main__':
idle_dir = os.path.dirname(__file__)
else:
idle_dir = os.path.abspath(sys.path[0])
idle_dir = os.path.abspath(idlelib.__file__)
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
27 changes: 18 additions & 9 deletions Lib/test/test_idle/test_grep.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,26 @@ def test_curdir(self):

def test_base(self):
ff = grep.findfiles
readme = os.path.join(self.path, 'README.txt')
idle_test_root = readme = os.path.join(
os.path.dirname(os.path.dirname(self.path)),
'idlelib',
'idle_test',
)
readme = os.path.join(idle_test_root, 'README.txt')

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

# Look for .txt files in path where this file lives.
filelist = list(ff(self.path, '*.txt', False))
self.assertNotEqual(len(filelist), 0)
self.assertNotIn(self.realpath, filelist)
filelist = list(ff(idle_test_root, '*.txt', False))
self.assertGreater(len(filelist), 0)
self.assertIn(readme, filelist)
for python_file in python_files:
self.assertNotIn(python_file, filelist)

# Look for non-matching pattern.
filelist = list(ff(self.path, 'grep.*', False))
Expand All @@ -88,7 +94,10 @@ def test_base(self):

def test_recurse(self):
ff = grep.findfiles
parent = os.path.dirname(self.path)
parent = os.path.join(
os.path.dirname(os.path.dirname(self.path)),
'idlelib',
)
grepfile = os.path.join(parent, 'grep.py')
pat = '*.py'

Expand Down