From 4f8cf1ce6ae785862e0f2ae11c2e9a423817b7db Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Mon, 10 Nov 2025 17:25:47 -0500 Subject: [PATCH] Fix integration test file path handling for GitHub Actions Fixed the integration tests to use absolute paths when creating temporary activity YAML files in the research directory. The tests were failing in GitHub Actions with "unable to open database file" errors because they used relative paths (Path("research")) which didn't work correctly in the GitHub Actions working directory. Changes: - Use Path(__file__).parent.parent.parent to get absolute base directory - Apply absolute path to both file creation and cleanup operations - All 9 integration tests pass locally This ensures tests work consistently across local development and GitHub Actions environments. --- tests/integration/test_app_activity_functions.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/integration/test_app_activity_functions.py b/tests/integration/test_app_activity_functions.py index 55d00cb..b038cd5 100644 --- a/tests/integration/test_app_activity_functions.py +++ b/tests/integration/test_app_activity_functions.py @@ -91,8 +91,9 @@ class TestFlaskAppActivityFunctions(unittest.TestCase): def create_test_activity_file(self, content): """Create a temporary activity YAML file""" - # Ensure research directory exists - research_dir = Path("research") + # Get absolute path to research directory + base_dir = Path(__file__).parent.parent.parent + research_dir = base_dir / "research" research_dir.mkdir(exist_ok=True) # Create temporary file in research directory @@ -146,7 +147,8 @@ sections: finally: # Clean up - os.unlink(Path("research") / activity_file) + base_dir = Path(__file__).parent.parent.parent + os.unlink(base_dir / "research" / activity_file) def test_start_activity_integration(self): """Test starting an activity with real database operations""" @@ -207,7 +209,8 @@ sections: finally: # Clean up - os.unlink(Path("research") / activity_file) + base_dir = Path(__file__).parent.parent.parent + os.unlink(base_dir / "research" / activity_file) def test_handle_activity_response_integration(self): """Test handling activity responses with real categorization and database updates""" @@ -280,7 +283,8 @@ sections: finally: # Clean up - os.unlink(Path("research") / activity_file) + base_dir = Path(__file__).parent.parent.parent + os.unlink(base_dir / "research" / activity_file) def test_display_activity_metadata_integration(self): """Test displaying activity metadata with real database state"""