Closed mkundu1 closed 5 months ago
Hi. I was looking at this recently and had issues pytest: command not found.
And it seemed to be because poetry is running in default mode and creating a virtualenv which is not activated in the github actions. I created an environment variable to configure poetry not to do this in the CI/CD so poetry should be found.
POETRY_VIRTUALENVS_CREATE = false
Hi @philipjusher thanks for commenting and using our actions! Could you share a Code snippet of the changes you performed so that we understand your issues and solution? Really appreciated! A URL also works =)
Here is the snippet from the github action that calls tests-pytest I think it what you need. So you set the POETRY_VIRTUALENVS_CREATE to false either as repo variable or you could write in your pipeline.
steps:
- uses: ansys/actions/tests-pytest@v5
env:
POETRY_VIRTUALENVS_CREATE: ${{ vars.POETRY_VIRTUALENVS_CREATE }} # false
with:
pytest-extra-args: "--cov=ansys --cov-report=term --cov-report=html:.cov/html"
This means that it doesnt create a virtual environment so you dont get the problem of pytest: command not found
I'm think this also means you havent got a test for the poetry option of this action.
Hi @philipjusher - the way we have it right now is that poetry (in case of tests) tries to install a group called tests
. See https://github.com/ansys/actions/blob/main/tests-pytest/action.yml#L139
If you have pytest defined inside your group, this should solve your issues. You should also define your test dependencies inside it.
Something like this for example:
I checked that first
However poetry creates in a python virtualenv and there is nothing that activates that before you run the pytest command on line 148. The solution I had was to make sure it didnt create the virtualenv and installed to the system python. Our code is here for now https://github.com/ansys-internal/pyconceptev-core
Gotcha! Thanks for the explanation. I will add this right away directly inside the various poetry actions. Thanks a bunch!
https://github.com/ansys/pyfluent-reader/actions/runs/6469381862/job/17563451958#step:2:451
https://github.com/ansys/pyfluent-reader/actions/runs/6469381862/job/17563344927#step:2:1063