pytest-testmon icon indicating copy to clipboard operation
pytest-testmon copied to clipboard

New DB in GitHub Actions after restoring environment & .testmondata from cache

Open alankritjoshi opened this issue 1 year ago • 1 comments

What is your setup and what steps did you do? Please show us also the command/s you executed. What is the code you used?

I am trying to use testmon in Github Actions so that the PRs run only new changes against the cached .testmondata (generated by main branch)

pr.yml

      - name: Checkout code
        uses: actions/checkout@v4

      - name: Poetry
        shell: bash
        run: |
          pip install pipx
          pipx ensurepath
          pipx install poetry==1.8.2

          pipx install poethepoet==0.25.0
          poetry config virtualenvs.in-project true

      - name: Setup Python 3.10
        uses: actions/setup-python@v5
        with:
          python-version: '3.10'
          cache: 'poetry'

      - name: Install
        run: |
          poetry install

      - name: Pytest cache restore
        uses: actions/cache/restore@v3
        with:
          path: .testmondata
          key: testmon-main-${{ github.sha }}
          restore-keys: |
            testmon-main-

      - name: Run tests
        run: |
          poetry run pytest --testmon

What was the outcome? Please also copy (redacted if need be) pytest output including the pytest version, plugins list and versions and pytest rootdir here

All the tests are re-run instead of running only relevant changed/added tests.

I noticed, each run starts with:

testmon: new DB, environment: default

I am not sure why it initializes a new DB if .testmondata is restored from cache.

What did you expect instead?

Testmon works as expected and only runs changed tests by using the cache recovered .testmondata.

What is your operating system and it's version please?

Ubuntu Github Action runner

alankritjoshi avatar Aug 13 '24 05:08 alankritjoshi

Also seeing the same thing

jacksongoode avatar Nov 17 '24 03:11 jacksongoode