Fix test_suite.py test failure due to Python 3.13 glob.glob() behavior change

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Correctness
    • Fully Compatible
    • Correctness 2026-01-12
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      ISSUE
      The test buildscripts/tests/resmokelib/testing/test_suite.py::TestGetTestsForKind::test_simple fails when run with Python 3.13 but passes with Python 3.10.

      Error:
      TypeError: startswith first arg must be str or a tuple of str, not NoneType
        File "buildscripts/resmokelib/selector.py", line 225, in _evaluate_paths
          if len_after == len_before and path.startswith(
              self._test_file_explorer.get_jstests_dir()  # Returns None
          ):

      ROOT CAUSE
      Python 3.13 changed the behavior of glob.glob() when matching patterns against non-existent directories.

      Python 3.10 Behavior:

      • glob.glob('testroot/**', recursive=True) returns ['testroot'] even when testroot doesn't exist
      • This is a "phantom result"

      Python 3.13 Behavior:

      • glob.glob('testroot/**', recursive=True) returns [] when testroot doesn't exist
      • This is the correct behavior

      The change was made in the _glob2() function in Python's glob module:
      https://github.com/python/cpython/blob/v3.10.0/Lib/glob.py#L121

      https://github.com/python/cpython/blob/v3.13.0/Lib/glob.py#L143

            Assignee:
            Nicholas Jefferies
            Reporter:
            Nicholas Jefferies
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: