Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autograder failure #2

Open
rlalik opened this issue Jul 25, 2024 · 2 comments
Open

Autograder failure #2

rlalik opened this issue Jul 25, 2024 · 2 comments

Comments

@rlalik
Copy link

rlalik commented Jul 25, 2024

In one of my students repositories autograde was not providing the grade. After opening actions logs, I found out a weird trackback:

Run classroom-resources/autograding-python-grader@v1
  with:
    timeout: 10
    max-score: 5
/usr/bin/docker run --name e9119969bb13f109340dab87ae1bd5ec50708_844bc3 --label 8e9119 --workdir /github/workspace --rm -e "INPUT_TIMEOUT" -e "INPUT_MAX-SCORE" -e "INPUT_SETUP-COMMAND" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -
TIMEOUT is 600 seconds
MAX_SCORE is 5
============================= test session starts ==============================
platform linux -- Python 3.11.[2](https://github.com/REPO_URL_1/actions/runs/9726165017/job/27907221531#step:4:2), pytest-7.2.2, pluggy-1.5.0
rootdir: /github/workspace
plugins: subtests-0.11.0
collected 52 items
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python[3](https://github.com/REPO_URL_1/actions/runs/9726165017/job/27907221531#step:4:3).11/site-packages/_pytest/main.py", line 270, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_callers.py", line 182, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_result.py", line 100, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/_pytest/main.py", line 33[4](https://github.com/REPO_URL_1/actions/runs/9726165017/job/27907221531#step:4:4), in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/_pytest/main.py", line 667, in perform_collect
INTERNALERROR>     hook.pytest_collection_modifyitems(
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_hooks.py", line [5](https://github.com/REPO_URL_1/actions/runs/9726165017/job/27907221531#step:4:6)13, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_callers.py", line 182, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_result.py", line 100, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/usr/local/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/opt/test-runner/runner/__init__.py", line 50, in pytest_collection_modifyitems
INTERNALERROR>     items.sort(key=_sort_by_lineno)
INTERNALERROR>   File "/opt/test-runner/runner/__init__.py", line 48, in _sort_by_lineno
INTERNALERROR>     return TestOrder.lineno(test_id, source)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/opt/test-runner/runner/sort.py", line 93, in lineno
INTERNALERROR>     cls(Hierarchy(test_id.split("::")[0])).visit(tree)
INTERNALERROR>   File "/usr/local/lib/python3.11/ast.py", line 418, in visit
INTERNALERROR>     return visitor(node)
INTERNALERROR>            ^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/lib/python3.11/ast.py", line 42[6](https://github.com/REPO_URL_1/actions/runs/9726165017/job/27907221531#step:4:7), in generic_visit
INTERNALERROR>     self.visit(item)
INTERNALERROR>   File "/usr/local/lib/python3.11/ast.py", line 41[8](https://github.com/REPO_URL_1/actions/runs/9726165017/job/27907221531#step:4:9), in visit
INTERNALERROR>     return visitor(node)
INTERNALERROR>            ^^^^^^^^^^^^^
INTERNALERROR>   File "/opt/test-runner/runner/sort.py", line 38, in visit_ClassDef
INTERNALERROR>     bases = {f"{base.value.id}.{base.attr}" for base in node.bases}
INTERNALERROR>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/opt/test-runner/runner/sort.py", line 38, in <setcomp>
INTERNALERROR>     bases = {f"{base.value.id}.{base.attr}" for base in node.bases}
INTERNALERROR>                 ^^^^^^^^^^
INTERNALERROR> AttributeError: 'Name' object has no attribute 'value'
============================ no tests ran in 0.06s =============================
@Conerzyo
Copy link

Conerzyo commented Sep 6, 2024

You are not alone. I have the same problem.

This is my classroom.yaml file:

name: Autograding Tests
'on':
- push
- repository_dispatch
permissions:
  checks: write
  actions: read
  contents: read
jobs:
  run-autograding-tests:
    runs-on: ubuntu-latest
    if: github.actor != 'github-classroom[bot]'
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: Automatická kontrola úkolů
      id: automaticka-kontrola-ukolu
      uses: classroom-resources/autograding-python-grader@v1
      with:
        timeout: 5
        max-score: 1
        setup-command: ''
    - name: Autograding Reporter
      uses: classroom-resources/autograding-grading-reporter@v1
      env:
        AUTOMATICKA-KONTROLA-UKOLU_RESULTS: "${{steps.automaticka-kontrola-ukolu.outputs.result}}"
      with:
        runners: automaticka-kontrola-ukolu

@Conerzyo
Copy link

Conerzyo commented Sep 6, 2024

And I have fixed it @rlalik. I had to go through the codebase a bit.

Obviously a skill issue on my side, so try to follow my steps (if you have not fixed it already).

The first step was that I renamed all the tests to fit the default pytest prefix test_*.

The next step was that I added to the end of every python file with tests this:

if __name__ == "__main__":
    unittest.main()

Now my runner can discover and run tests properly. ✌🏼

Happy teaching buddy!

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

No branches or pull requests

2 participants