Skip to content

Conversation

@rlalik
Copy link

@rlalik rlalik commented Nov 26, 2024

Small update allowing to change the location (relative to the tested repository) where pytest should start to look for tests.

I had a case where I wanted to have separate graders for subprojects, like my tree structure:

.
├── zadanie_1
│   └── tests
├── zadanie_2
│   └── tests
└── zadanie_3
    └── tests

and I wanted to run grader in each subdirectory separately:

    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: Python Test - Zadanie 1
      id: test-zadanie-1
      uses: rlalik/autograding-python-grader@v1.1
      with:
        timeout: 10
        max-score: 1.5
        working-directory: zadanie_1
    - name: Python Test - Zadanie 2
      id: test-zadanie-2
      uses: rlalik/autograding-python-grader@v1.1
      with:
        timeout: 10
        max-score: 2
        setup-command: pip install -r requirements.txt
        working-directory: zadanie_2
    - name: Python Test - Zadanie 3
      id: test-zadanie-3
      uses: rlalik/autograding-python-grader@v1.1
      with:
        timeout: 10
        max-score: 1.5
        working-directory: zadanie_3
    - name: Autograding Reporter
      uses: classroom-resources/autograding-grading-reporter@v1
      env:
        TEST-ZADANIE-1_RESULTS: "${{steps.test-zadanie-1.outputs.result}}"
        TEST-ZADANIE-2_RESULTS: "${{steps.test-zadanie-2.outputs.result}}"
        TEST-ZADANIE-3_RESULTS: "${{steps.test-zadanie-3.outputs.result}}"
      with:
        runners: test-zadanie-1,test-zadanie-2,test-zadanie-3

giving following summary:

| Test runner summary
| ┌────────────────────┬─────────────┬─────────────┐
| │ Test Runner Name   │ Test Score  │ Max Score   │
| ├────────────────────┼─────────────┼─────────────┤
| │ test-zadanie-1     │ 1.5         │ 1.5         │
| ├────────────────────┼─────────────┼─────────────┤
| │ test-zadanie-2     │ 1.2         │ 2           │
| ├────────────────────┼─────────────┼─────────────┤
| │ test-zadanie-3     │ 1.5         │ 1.5         │
| ├────────────────────┼─────────────┼─────────────┤
| │ Total:             │ 4.2         │ 5           │
| └────────────────────┴─────────────┴─────────────┘
| 🏆 Grand total tests passed: 15/16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant