diff --git a/.github/workflows/test-docker-image.yml b/.github/workflows/test-docker-image.yml index 1691db92..edcc4d26 100644 --- a/.github/workflows/test-docker-image.yml +++ b/.github/workflows/test-docker-image.yml @@ -30,34 +30,38 @@ jobs: docker run --name test_container -d ghcr.io/$REPO_LOWERCASE:latest tail -f /dev/null WORK_DIR="/" - echo "Using working directory: $WORK_DIR" # Copy entire project directory to the container docker cp . test_container:$WORK_DIR - # Verify the tests were copied correctly - echo "Contents of $WORK_DIR/tests:" - docker exec test_container ls -la $WORK_DIR/tests - echo "Contents of $WORK_DIR/tests/data:" - docker exec test_container ls -la $WORK_DIR/tests/data + # Verify the directory structure + echo "Contents of root directory:" + docker exec test_container ls -la $WORK_DIR + echo "Contents of tests directory (if it exists):" + docker exec test_container ls -la $WORK_DIR/tests || echo "No tests directory found" + echo "Contents of data directory (if it exists):" + docker exec test_container ls -la $WORK_DIR/data || echo "No data directory found" # Print debugging information echo "Current working directory:" docker exec -w $WORK_DIR test_container pwd - echo "Full path of test directory:" - docker exec test_container readlink -f $WORK_DIR/tests - # Print content of a test file - echo "Content of a test file that accesses data (first 20 lines):" - docker exec test_container head -n 20 $WORK_DIR/tests/test_*.py + # Find and print content of a test file + echo "Content of a test file (first 20 lines):" + docker exec test_container find $WORK_DIR -name "test_*.py" -type f | head -n 1 | xargs -I {} docker exec test_container head -n 20 {} # Install pytest docker exec test_container pip install pytest - # Run pytest from the working directory - echo "Running pytest from the working directory:" - docker exec -w $WORK_DIR test_container pytest tests -v + # Find the directory containing test files and run pytest + TEST_DIR=$(docker exec test_container find $WORK_DIR -name "test_*.py" -type f | head -n 1 | xargs dirname) + if [ -n "$TEST_DIR" ]; then + echo "Running pytest in directory: $TEST_DIR" + docker exec -w $TEST_DIR test_container pytest -v + else + echo "No test files found" + fi # Clean up docker stop test_container