diff --git a/.coverage b/.coverage deleted file mode 100644 index 371394d..0000000 Binary files a/.coverage and /dev/null differ diff --git a/.gitignore b/.gitignore index db2fcf9..6d64161 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ __pycache__/ .aws-sam/ samconfig.toml vars.sh +.coverage +htmlcov/ diff --git a/tests/functional/test_activity_flows.py b/tests/functional/test_activity_flows.py index 1c64f5f..e5f7780 100644 --- a/tests/functional/test_activity_flows.py +++ b/tests/functional/test_activity_flows.py @@ -379,8 +379,8 @@ class TestRealActivityFiles(unittest.TestCase): mock_get_client.return_value = (self.mock_client, "test-model") # Load actual activity3.yaml - activity_file = "/home/fox/git/opencompletion/research/activity3.yaml" - activity = guarded_ai.load_yaml_activity(activity_file) + activity_file = Path(__file__).parent.parent.parent / "research" / "activity3.yaml" + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Should have section_5 as the terminal section section_5 = None @@ -408,9 +408,9 @@ class TestRealActivityFiles(unittest.TestCase): mock_get_client.return_value = (self.mock_client, "test-model") activity_file = ( - "/home/fox/git/opencompletion/research/activity17-choose-adventure.yaml" + Path(__file__).parent.parent.parent / "research" / "activity17-choose-adventure.yaml" ) - activity = guarded_ai.load_yaml_activity(activity_file) + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Find a step with metadata_remove operations found_remove_operation = False @@ -450,9 +450,9 @@ class TestRealActivityFiles(unittest.TestCase): mock_get_client.return_value = (self.mock_client, "test-model") activity_file = ( - "/home/fox/git/opencompletion/research/activity20-n-plus-1.yaml" + Path(__file__).parent.parent.parent / "research" / "activity20-n-plus-1.yaml" ) - activity = guarded_ai.load_yaml_activity(activity_file) + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Find the step with integer bucket (1912) found_integer_bucket = False diff --git a/tests/functional/test_battleship_pre_script.py b/tests/functional/test_battleship_pre_script.py index 7f0a8a4..db9226a 100644 --- a/tests/functional/test_battleship_pre_script.py +++ b/tests/functional/test_battleship_pre_script.py @@ -28,9 +28,9 @@ class TestBattleshipPreScript(unittest.TestCase): def test_battleship_yaml_has_pre_script(self): """Test that battleship YAML loads and has pre_script""" activity_file = ( - "/home/fox/git/opencompletion/research/activity29-battleship.yaml" + Path(__file__).parent.parent.parent / "research" / "activity29-battleship.yaml" ) - activity = guarded_ai.load_yaml_activity(activity_file) + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Find step with pre_script found_pre_script = False @@ -57,9 +57,9 @@ class TestBattleshipPreScript(unittest.TestCase): def test_battleship_pre_script_execution_simulation(self): """Test simulated battleship pre_script execution""" activity_file = ( - "/home/fox/git/opencompletion/research/activity29-battleship.yaml" + Path(__file__).parent.parent.parent / "research" / "activity29-battleship.yaml" ) - activity = guarded_ai.load_yaml_activity(activity_file) + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Find the step with pre_script (step_2) step_with_pre_script = None @@ -96,8 +96,8 @@ class TestBattleshipPreScript(unittest.TestCase): def test_testship_yaml_has_pre_script(self): """Test that testship YAML also has pre_script""" - activity_file = "/home/fox/git/opencompletion/research/activity29-testship.yaml" - activity = guarded_ai.load_yaml_activity(activity_file) + activity_file = Path(__file__).parent.parent.parent / "research" / "activity29-testship.yaml" + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Should also have pre_script (same structure as battleship) found_pre_script = False diff --git a/tests/functional/test_guarded_ai.py b/tests/functional/test_guarded_ai.py index a5a6114..69f6adf 100644 --- a/tests/functional/test_guarded_ai.py +++ b/tests/functional/test_guarded_ai.py @@ -320,8 +320,8 @@ class TestActivityYAMLChanges(unittest.TestCase): """Test that activity3's new terminal section loads correctly""" import guarded_ai as guarded_ai - activity_file = "/home/fox/git/opencompletion/research/activity3.yaml" - activity = guarded_ai.load_yaml_activity(activity_file) + activity_file = Path(__file__).parent.parent.parent / "research" / "activity3.yaml" + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Should have section_5 now section_ids = [section["section_id"] for section in activity["sections"]] @@ -348,9 +348,9 @@ class TestActivityYAMLChanges(unittest.TestCase): import guarded_ai as guarded_ai activity_file = ( - "/home/fox/git/opencompletion/research/activity17-choose-adventure.yaml" + Path(__file__).parent.parent.parent / "research" / "activity17-choose-adventure.yaml" ) - activity = guarded_ai.load_yaml_activity(activity_file) + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Find steps with metadata_remove found_metadata_remove = False @@ -375,8 +375,8 @@ class TestActivityYAMLChanges(unittest.TestCase): "activity29-battleship.yaml", "activity29-testship.yaml", ]: - activity_file = f"/home/fox/git/opencompletion/research/{battleship_file}" - activity = guarded_ai.load_yaml_activity(activity_file) + activity_file = Path(__file__).parent.parent.parent / "research" / battleship_file + activity = guarded_ai.load_yaml_activity(str(activity_file)) # Find exit transitions and verify they go to step_4 exit_transitions_found = 0 diff --git a/tests/integration/test_activity_processing.py b/tests/integration/test_activity_processing.py index e263742..78da2d3 100644 --- a/tests/integration/test_activity_processing.py +++ b/tests/integration/test_activity_processing.py @@ -11,6 +11,7 @@ import tempfile import json import sys import os +import yaml from unittest.mock import Mock, patch, MagicMock from pathlib import Path @@ -446,7 +447,7 @@ script_result = {'status': 'error'} with open(test_file, "w") as f: f.write(malformed_yaml) - with self.assertRaises(Exception): # YAML parsing error + with self.assertRaises(yaml.YAMLError): # YAML parsing error app.get_activity_content("research/malformed.yaml") finally: