pandas-ai icon indicating copy to clipboard operation
pandas-ai copied to clipboard

Test coverage report

Open Lorenzobattistela opened this issue 1 year ago • 6 comments

🚀 The feature

Test coverage report using coverage.py to assure safety to users and devs.

Motivation, pitch

Discussed on discord with @gventuri

Alternatives

No response

Additional context

You can assign me for this task

Lorenzobattistela avatar May 09 '23 17:05 Lorenzobattistela

Awesome, go for it @Lorenzobattistela 🚀

gventuri avatar May 09 '23 17:05 gventuri

@gventuri I'm using cover.py library to generate a nice HTML report about coverage. Test coverage badges are in general installed as GH actions and it is needed to configure env variables.

I'll need to update the CI, and I want to share it with you before (because .yml changes could mess up other workflow runs):

Something like this:

name: pandas_ai_ci

on:
  push:
    branches: [main]
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.9", "3.10", "3.11"]

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install poetry
        run: pip install poetry==1.4.2
      - name: Install dependencies
        run: poetry install
      - name: Lint with pylint
        run: poetry run pylint pandasai examples
      - name: Test with pytest and coverage
        run: poetry run pytest --cov=pandasai --cov-report=xml --cov-report=html
      - name: Upload coverage report to Codecov
        uses: codecov/codecov-action@v2
        with:
          files: coverage.xml
          

For this to work, pandasAI would need to have an account on codecov and a token. I'm not aware about pricing, I think it is free for OS projects. I know it is also possible to display the badge with codecov. What do you think?

Coverage report only (without badges or images, just the cli) can be easily achieved installing coverage.py and running coverage run -m pytest

Lorenzobattistela avatar May 09 '23 19:05 Lorenzobattistela

@Lorenzobattistela, will you move forward with this implementation?

HenriqueAJNB avatar May 09 '23 23:05 HenriqueAJNB

@HenriqueAJNB sounds like a great idea. I'll create the account on codecov shortly and setup the keys. I've also seen it's free for open source projects!

gventuri avatar May 09 '23 23:05 gventuri

Sure! I'm a little bit overwhelmed today, but tomorrow I'll handle it.

Lorenzobattistela avatar May 10 '23 17:05 Lorenzobattistela

@Lorenzobattistela any news about it? Can I help you somehow?

gventuri avatar May 27 '23 10:05 gventuri