1

I am new to tox and GitHub actions and I'm facing a problem. tox testenv commands don't seem to run on a self-hosted server. This is the result of pushing a commit to the github repository:

tox
...
___________________________________ summary ____________________________________
  congratulations :)

however, expected result should look like this:

tox
...
============================== 1 passed in 0.17s ==============================
___________________________________ summary ___________________________________
  py310: commands succeeded
  congratulations :)

my tox.ini file:

[tox]
minversion = 3.10
envlist = py310
isolated_build = true

[testenv]
setenv =
    PYTHONPATH = {toxinidir}
deps =
    -r{toxinidir}/requirements_dev.txt
commands =
    pytest --basetemp={envtmpdir}

github workflows file

name: Tests

on:
  - push
  - pull_request

jobs:
  test:
    runs-on: self-hosted
    strategy:
      matrix:
        python-version: ['3.10.6']
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install tox
      - name: Test with tox
        run: |
          tox

however, the code above works properly on a virtual machine hosted by GitHub. (runs-on: ubuntu-latest) My server runs on Ubuntu 20.04.4 LTS. Is there anything I am doing wrong, how do i fix that?

  • try changing your pytest settings maybe... or try intentionally failing a test and see if it produces different output – Alexander Aug 12 '22 at 22:28
  • intentionally failing test didn't change anything. However, when running tox locally on my windows machine, it works as it should. Also, when I run tox on my ubuntu server it results with an error (but it executes commands properly) – Wysciguvvka Aug 12 '22 at 22:35
  • Well it was worth a try... Ill upvote question hopefully someone else will know what to do. – Alexander Aug 12 '22 at 22:45

1 Answers1

0

Ok, I managed to fix that issue by adding

[gh-actions]
python =
    3.10: py310

to the tox.ini file

  • 1
    This cannot work without also installing the corresponding plugin. So something is missing, either in the initial question or the answer. – Jürgen Gmach Aug 13 '22 at 12:15
  • 1
    Indeed, I didnt mention that I added `pip install tox tox-gh-actions` to my github workflow file – Wysciguvvka Aug 14 '22 at 11:10