Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests-pytest and doc-build actions fail for pyansys-advanced with poetry template #348

Closed
mkundu1 opened this issue Oct 10, 2023 · 7 comments · Fixed by #423
Closed

tests-pytest and doc-build actions fail for pyansys-advanced with poetry template #348

mkundu1 opened this issue Oct 10, 2023 · 7 comments · Fixed by #423

Comments

@mkundu1
Copy link

mkundu1 commented Oct 10, 2023

https://github.com/ansys/pyfluent-reader/actions/runs/6469381862/job/17563451958#step:2:451

/home/runner/work/_temp/98be34b6-060e-4d3a-9fac-879cfefcd336.sh: line 1: pytest: command not found

https://github.com/ansys/pyfluent-reader/actions/runs/6469381862/job/17563344927#step:2:1063

/bin/sh: 1: sphinx-build: not found
@philipjusher
Copy link

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

@RobPasMue
Copy link
Member

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 =)

@philipjusher
Copy link

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.

@RobPasMue
Copy link
Member

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.

@RobPasMue
Copy link
Member

Something like this for example:

image

@philipjusher
Copy link

I checked that first
image
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

@RobPasMue
Copy link
Member

Gotcha! Thanks for the explanation. I will add this right away directly inside the various poetry actions. Thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants