Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

tests: flakey test_directory_scanner test (#8284)

Myles Scolnick93f864afd3ee
diff --git a/tests/_server/test_directory_scanner.py b/tests/_server/test_directory_scanner.py
index 0dd1a1cdbd..0d33a58db8 100644
--- a/tests/_server/test_directory_scanner.py
+++ b/tests/_server/test_directory_scanner.py
@@ -106,8 +106,18 @@ class TestDirectoryScanner(unittest.TestCase):
scanner = DirectoryScanner(self.test_dir, max_files=5)
files = scanner.scan()
- file_count = sum(1 for f in files if not f.is_directory)
- assert file_count == 5
+
+ def count_files(file_list: list) -> int:
+ total = 0
+ for f in file_list:
+ if f.is_directory:
+ if f.children:
+ total += count_files(f.children)
+ else:
+ total += 1
+ return total
+
+ assert count_files(files) == 5
def test_skip_common_directories(self):
"""Test that common directories are skipped."""