I'm trying to use 'pytest' to run tests for job in GitLab. In the project I uses poetry, but after the command 'poetry install' does not see the installed libraries. Error:
pytest: command not found
My *-gitlab-ci.yml:
stages:
- testing
test_job:
image: python:3.11-slim
stage: testing
script:
- 'apt-get update && apt-get install -y curl jq && curl -sSL https://install.python-
poetry.org | python3'
- 'PATH="$PATH:/root/.local/bin/"'
- 'poetry config virtualenvs.create false && poetry install'
- 'pytest tests'
In Job everything need is installed, I check later 'poetry --version' / 'python --version', they are in place, but Python libraries (pytest) give errors.
My pyproject.toml:
[tool.poetry]
name = "pytestwithtesting"
version = "0.1.0"
description = "educational project"
authors = ["avtest <[email protected]>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.8"
pytest = "^8.2.2"
pyhamcrest = "^2.1.0"
cards = "^2.0.0"
allure-pytest = "^2.13.5"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
And the project structure is small:
pytestwithtesting-|
|- /tests
|-.gitlab-ci.yml
|- REAMDE.md
|- poetry.toml
|- pyproject.toml
Please tell me what I might have missed?
source .. activate
worked for me
- pip install -q poetry
- python -m poetry install --no-interaction
- source `poetry env info --path`/bin/activate