Skip to content
Closed
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
Better findfile docs
  • Loading branch information
sobolevn committed Jan 23, 2024
commit 55274c2e202a02d240bfcf13186ec8875ef40512
4 changes: 3 additions & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,13 @@ def findfile(filename, subdir=None):

Setting *subdir* indicates a relative path to use to find the file
rather than looking directly in the path directories.
It can be either a string or a tuple of strings,
which will be joined with the correct path separator.
"""
if os.path.isabs(filename):
return filename
if subdir is not None:
if not isinstance(subdir, str):
if isinstance(subdir, tuple):
subdir = os.path.join(*subdir)
filename = os.path.join(subdir, filename)
path = [TEST_HOME_DIR] + sys.path
Expand Down