diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index fcbf6aa..bc27df9 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -37,7 +37,7 @@ jobs: run: | # Find all files in the 'Test' directory and join them into a space-separated string #TEST_SCRIPTS=$(find Test -type f ! -name '__init__.py' -print | tr '\n' ' ') - TEST_SCRIPTS=$(find testing -type f -name '*test_test.py' -print | tr '\n' ' ') + TEST_SCRIPTS=("testing/pytest_test.py", "testing/upload_sync_test.py") echo "Found test scripts: $TEST_SCRIPTS" echo "TEST_SCRIPTS=$TEST_SCRIPTS" >> $GITHUB_ENV - name: Run Tests diff --git a/testing/upload_test_sync.py b/testing/upload_sync_test.py similarity index 93% rename from testing/upload_test_sync.py rename to testing/upload_sync_test.py index 4ec0d7b..e051e92 100644 --- a/testing/upload_test_sync.py +++ b/testing/upload_sync_test.py @@ -11,6 +11,7 @@ import json import logging from pprint import pprint +import pytest # Configure logging logging.basicConfig( @@ -79,8 +80,8 @@ def generate_payload_from_data(self, dataset: Dataset) -> Dict: } return payload - -async def run_test(show_payload: bool = False): +@pytest.mark.asyncio +async def test_upload(show_payload: bool = False): logger.info("Starting run_test") # Create test agent agent = TestAgent() @@ -99,11 +100,9 @@ async def run_test(show_payload: bool = False): for i, question in enumerate(questions): logger.info("Processing question %d: %s", i, question) try: - # First process in environment ========================================================== env_result = agent.process_environment(question) logger.debug("Environment processing result: %s", env_result) - # Then make LM call ===================================================================== response = agent.make_lm_call(question) responses.append(response) logger.debug("Response received and stored: %s", response) @@ -148,13 +147,6 @@ async def run_test(show_payload: bool = False): logger.info("Payload sent to server:") pprint(payload) - try: - assert(payload == agent.generate_payload_from_data(dataset)) - logger.info("Payload correct") - except AssertionError: - logger.error("Payload incorrect") - pprint(payload) - except Exception as e: logger.error("Upload failed: %s", str(e), exc_info=True) print(f"Upload failed: {str(e)}") @@ -192,9 +184,11 @@ async def run_test(show_payload: bool = False): f"Error during cleanup of event {event_type}: {str(e)}" ) logger.info("Cleanup completed") + assert payload == agent.generate_payload_from_data(dataset) # Run a sample agent using the async decorator and tracker if __name__ == "__main__": + assert 1 + 1 == 2 logger.info("Starting main execution") asyncio.run(run_test()) logger.info("Main execution completed")