While trying to enable GitHub Actions CI to this small Python package called once-utils I bumped into two issues:

1. Some of the tests required gradle to be installed, somehting that seemed arbitrary and not very straigh forward to have.

2. There was no easy way to install all the dependencies. (No requirements.txt file)

See the PyDigger stats page for more modules that don't have Continuous Integration.

As I did not want to fiddle with the installation of gradle I decided that instead of running pytest and expecting it to find all the tests file, for the initial Pull-Request I'll list the test files I'd like to be checked. Not ideal, but I think it is better to go in small steps than to be stuck in-front of a big step. So the command I used was

pytest -vs tests/test_iter.py tests/test_random.py

The ideal way to find out the dependencies was creating a separate virtual envioronment locally and trying to run the tests locally. I was lazy and did not do that so I had to add them one-by-one as GitHub Actions reported failures. Luckily there were only 2 missing dependencies besides pytest.

I ended up adding a requirements.txt file with the following lines in it:

httpx
requests

And adding the following file as .github/workflows/ci.yml

examples/once-utils-ci.yml

name: Python

on:
  push:
  pull_request:

jobs:
  build_python:

    strategy:
      matrix:
        runner: [ubuntu-latest, macos-latest] # , windows-latest
        python-version: ["3.9", "3.10", "3.11.0-rc.2"]

    runs-on: ${{matrix.runner}}
    name: OS ${{matrix.runner}} Python ${{matrix.python-version}}

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        pip install pytest
        pip install -r requirements.txt

    - name: Check Python version
      run: python -V

    - name: Test with pytest
      env:
        PYTHONPATH: .
      run: pytest -vs tests/test_iter.py tests/test_random.py

I also had to disable testing on Windows as that was failing and I also removed the testing on Python 3.11.0 RC 2, though that turned out to be a misunderstanding on my behalf so I added it back.