'AttributeError when using Github self-hosted runners to run unit test

Hello~ I am trying to use Github workflow to run the unit test for the code in my repository.

So I wrote a yaml file, its function is when I push my code to my repository, it can let me use my local environment to execute my code on Github, and the purpose of these codes is to run the unit tests.

But I can't run this workflow successfully, this error message always appears. I'm curious why I can execute unit test successfully on the local IDE, but it doesn't work when I use workflow to automatically execute it for me.

============================== warnings summary ===============================
..\..\..\..\anaconda3\lib\site-packages\pyreadline\py3k_compat.py:8
  C:\Users\COA\anaconda3\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    return isinstance(x, collections.Callable)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

=========================== short test summary info ===========================
ERROR test/test_createds_for_fnn.py - AttributeError: type object 'h5py.h5.H5...
ERROR test/test_fnn.py - AttributeError: type object 'h5py.h5.H5PYConfig' has...
ERROR test/test_unet.py - AttributeError: type object 'h5py.h5.H5PYConfig' ha...
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!
======================== 1 warning, 3 errors in 2.76s =========================
Error: Process completed with exit code 1.

My environment:

  • Windows 10 OS
  • Python 3.8.8
  • Tensorflow-gpu 2.7.0
  • pytest 6.2.3
  • h5py 3.6.0

Workflow

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: self-hosted

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v3

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world!

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project
          echo train the fnn
          pytest


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source