From 1c057a88fb4a8ca97f27605960e94a6973f22531 Mon Sep 17 00:00:00 2001 From: Adam Patch Date: Thu, 15 Jan 2026 14:11:00 -0500 Subject: [PATCH 1/3] fix(tests): add missing tests/__init__.py and remove obsolete e2e tests - Add tests/__init__.py to fix 'ModuleNotFoundError: No module named tests.helpers' - Remove obsolete pytest-playwright tests (test_graph_features.py, test_scan_workflow.py) - These are superseded by TypeScript Playwright tests in e2e/*.spec.ts - They reference non-existent 'page_helpers' fixture Remaining test failures are pre-existing bugs unrelated to E2E work: - test_folder_config_precedence: folder-level .scidk.toml filtering not working - test_schema_file_folder: recursive scan not indexing nested files correctly --- tests/__init__.py | 1 + tests/e2e/test_graph_features.py | 20 ------------ tests/e2e/test_scan_workflow.py | 55 -------------------------------- 3 files changed, 1 insertion(+), 75 deletions(-) create mode 100644 tests/__init__.py delete mode 100644 tests/e2e/test_graph_features.py delete mode 100644 tests/e2e/test_scan_workflow.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..20a5687 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""SciDK test suite.""" diff --git a/tests/e2e/test_graph_features.py b/tests/e2e/test_graph_features.py deleted file mode 100644 index 623ff93..0000000 --- a/tests/e2e/test_graph_features.py +++ /dev/null @@ -1,20 +0,0 @@ -"""E2E tests for graph features""" -import pytest - - -@pytest.mark.e2e -class TestGraphFeatures: - - def test_graph_page_loads(self, page_helpers): - """Graph explorer page loads""" - page_helpers.goto_page("/map") - # Wait for graph to render using stable testid - page_helpers.wait_for_element("[data-testid='graph-explorer-root']", timeout=10000) - assert True - - def test_graph_visualization_exists(self, page_helpers): - """Visualization is present (stable testid)""" - page_helpers.goto_page("/map") - # Assert our stable container becomes visible rather than relying on library DOM - page_helpers.wait_for_element("[data-testid='graph-explorer-root']", timeout=10000) - assert page_helpers.page.is_visible("[data-testid='graph-explorer-root']") diff --git a/tests/e2e/test_scan_workflow.py b/tests/e2e/test_scan_workflow.py deleted file mode 100644 index 4ba2fab..0000000 --- a/tests/e2e/test_scan_workflow.py +++ /dev/null @@ -1,55 +0,0 @@ -"""E2E tests for file scanning workflow""" -import tempfile -from pathlib import Path - -import pytest - - -@pytest.mark.e2e -class TestScanWorkflow: - - @pytest.fixture - def temp_test_directory(self): - with tempfile.TemporaryDirectory() as tmpdir: - Path(tmpdir, "test.py").write_text("def hello(): pass") - Path(tmpdir, "data.csv").write_text("col1,col2\n1,2") - yield tmpdir - - def test_scan_local_directory(self, page_helpers, temp_test_directory): - """User scans a directory and sees results""" - # Navigate to Files page - page_helpers.goto_page("/datasets") - - # Fill scan form using stable data-testids - page_helpers.page.fill("[data-testid='scan-path']", temp_test_directory) - page_helpers.page.click("[data-testid='scan-submit']") - page_helpers.page.wait_for_load_state("networkidle") - - # Verify something updated on the page (fallback: presence of tasks list or recent scans refresh) - page_helpers.wait_for_element("#tasks-list", timeout=10000) - - def test_scan_form_validation(self, page_helpers): - """Form validates empty input on Files page""" - # The scan form lives on /datasets - page_helpers.goto_page("/datasets") - - # Ensure the path input is empty then submit - sel_path = "[data-testid='scan-path']" - sel_submit = "[data-testid='scan-submit']" - # Clear any prefilled value - try: - page_helpers.page.fill(sel_path, "") - except Exception: - pass - page_helpers.page.click(sel_submit) - - # Expect either a validation message area to update or an alert - # Our UI writes into #tasks-list or could display a message near the form - ok = False - try: - page_helpers.wait_for_element("#tasks-list", timeout=3000) - ok = True - except Exception: - # Look for a generic validation clue - ok = page_helpers.page.is_visible(".error, .alert-danger, [role='alert'], #prov-scan-msg") - assert ok From 39b9149376e1e3f9c17b518632576d3022d7e17d Mon Sep 17 00:00:00 2001 From: Adam Patch Date: Thu, 15 Jan 2026 14:17:54 -0500 Subject: [PATCH 2/3] fix(core): add Python 3.10 compatibility for tomllib/tomli The folder_config.py and scans_service.py modules were importing tomllib which only exists in Python 3.11+, causing all folder-level .scidk.toml filtering to fail silently on Python 3.10. Changes: - Add try/except fallback to import tomli (backport) on Python < 3.11 - Fixes test_folder_config_precedence (folder include/exclude patterns) - Fixes test_schema_file_and_folder (recursive scan indexing) All 113 pytest tests now pass on Python 3.10. --- dev | 2 +- scidk/core/folder_config.py | 5 ++++- scidk/services/scans_service.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dev b/dev index 837127b..d6bb1b0 160000 --- a/dev +++ b/dev @@ -1 +1 @@ -Subproject commit 837127bb1cec6a07648cfdb0602a481da72d215f +Subproject commit d6bb1b0ce6daebdffe51208bd3e57c3790683c4a diff --git a/scidk/core/folder_config.py b/scidk/core/folder_config.py index 0e1b409..dea63f6 100644 --- a/scidk/core/folder_config.py +++ b/scidk/core/folder_config.py @@ -2,7 +2,10 @@ from pathlib import Path from typing import Dict, Any, Optional -import tomllib # Python 3.11+ +try: + import tomllib # Python 3.11+ +except ModuleNotFoundError: + import tomli as tomllib # Python < 3.11 fallback DEFAULTS = { 'include': [], # list of glob patterns diff --git a/scidk/services/scans_service.py b/scidk/services/scans_service.py index c23b57f..75d7866 100644 --- a/scidk/services/scans_service.py +++ b/scidk/services/scans_service.py @@ -230,7 +230,10 @@ def _dir_signature(dir_path: Path): try: tpath = Path(dpath) / '.scidk.toml' if tpath.exists(): - import tomllib as _toml + try: + import tomllib as _toml + except ModuleNotFoundError: + import tomli as _toml try: data = _toml.loads(tpath.read_text(encoding='utf-8')) except Exception: From 88d5e12eeaac1b268828f4c00ef8f420b99ab287 Mon Sep 17 00:00:00 2001 From: Adam Patch Date: Thu, 15 Jan 2026 14:20:54 -0500 Subject: [PATCH 3/3] chore: standardize on Python 3.12 across codebase Changes: - pyproject.toml: Update requires-python from >=3.10 to >=3.12 - docs/ux-runbook: Update Python requirement from 3.10+ to 3.12+ - scidk/core/folder_config.py: Remove tomli fallback (tomllib built-in since 3.11) - scidk/services/scans_service.py: Remove tomli fallback Rationale: - CI already uses Python 3.12 - bootstrap-dev.sh already requires python3.12 - tomllib is built-in since Python 3.11, no fallback needed for 3.12+ - Simplifies dependency management and removes version inconsistencies --- docs/ux-runbook-2025-09-12.md | 2 +- pyproject.toml | 2 +- scidk/core/folder_config.py | 5 +---- scidk/services/scans_service.py | 5 +---- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/ux-runbook-2025-09-12.md b/docs/ux-runbook-2025-09-12.md index 1146f76..b6ad5a1 100644 --- a/docs/ux-runbook-2025-09-12.md +++ b/docs/ux-runbook-2025-09-12.md @@ -35,7 +35,7 @@ Neo4j (optional; for graph projection testing only): ## 2) Starting the app -- Python: 3.10+ +- Python: 3.12+ - Install deps: pip install -r requirements.txt - Start: python start_scidk.py or `FLASK_APP=scidk.app:create_app flask run` (if configured). - Default UI: http://localhost:5000/ diff --git a/pyproject.toml b/pyproject.toml index fd3375f..ae2e1f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ version = "0.0.1" description = "SciDK - Science Data Kit (MVP)" authors = [{name = "SciDK Team"}] readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.12" dependencies = [ "Flask>=3.0", "openpyxl>=3.1", diff --git a/scidk/core/folder_config.py b/scidk/core/folder_config.py index dea63f6..c6a3d1a 100644 --- a/scidk/core/folder_config.py +++ b/scidk/core/folder_config.py @@ -2,10 +2,7 @@ from pathlib import Path from typing import Dict, Any, Optional -try: - import tomllib # Python 3.11+ -except ModuleNotFoundError: - import tomli as tomllib # Python < 3.11 fallback +import tomllib # Python 3.11+ (built-in) DEFAULTS = { 'include': [], # list of glob patterns diff --git a/scidk/services/scans_service.py b/scidk/services/scans_service.py index 75d7866..c23b57f 100644 --- a/scidk/services/scans_service.py +++ b/scidk/services/scans_service.py @@ -230,10 +230,7 @@ def _dir_signature(dir_path: Path): try: tpath = Path(dpath) / '.scidk.toml' if tpath.exists(): - try: - import tomllib as _toml - except ModuleNotFoundError: - import tomli as _toml + import tomllib as _toml try: data = _toml.loads(tpath.read_text(encoding='utf-8')) except Exception: