Hi, I have below yml file to run api & ui tests
and the pipeline throws 2 errors, I have removed caching steps and requirement.txt file but still running. Thanks in advance!
Python errors:
1- error computing cache key: template: cacheKey:1:32: executing "cacheKey" at <checksum "/tmp/cci_pycache/lockfile">: error calling checksum: open /tmp/cci_pycache/lockfile: no such file or directory
2- ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Playwright error:
!/bin/bash -eo pipefail
cd ~/ui/dashboard/app
/bin/bash: line 0: cd: /root/ui/dashboard/app: No such file or directory
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
orbs:
python: circleci/python@2.0.3
heroku: circleci/heroku@1.2.6
jobs:
api_test:
executor: python/default
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
name: Run tests
command: |
cd api
python -m pytest
ui_test_dashboard:
docker:
- image: "mcr.microsoft.com/playwright:v1.16.3"
working_directory: ~/ui/dashboard/app
steps:
- checkout
- run:
command: |
cd ~/ui/dashboard/app
npm i -D @playwright/test
- run:
command: |
cd ~/ui/dashboard/app
npx playwright install
- run:
name: run tests
command: |
cd ~/ui/dashboard/app
PLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test --reporter=junit --project=chromium
- store_test_results:
path: results.xml
ui_test_chcekout:
docker:
- image: "mcr.microsoft.com/playwright:v1.16.3"
working_directory: ~/ui/checkout_preact/app
steps:
- checkout
- run:
command: |
cd ~/ui/checkout_preact/app
npm i -D @playwright/test
- run:
command: |
cd ~/ui/checkout_preact/app
npx playwright install
- run:
name: run tests
command: |
cd ~/ui/dashboard/app
PLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test --reporter=junit --project=chromium
workflows:
version: 2
build:
jobs:
- api_test
- ui_test_dashboard
- ui_test_chcekout
You have not stated within which job the error is thrown, which makes commenting a little harder.
The first thing to look at will be the version of the circleci/python ORB that you are using as 2.0.3 is no longer documented, with 2.1.1 being the current release.
The docs for circleci/python indicate that requirement.txt is the default value for the parameter pip-dependency-file when using python/install-packages. So currently you are still doing this ‘step’ even if you have removed the line from the config.yaml file. If you do not want a dependency file you must set this parameter to an empty string.
I have edited that and now have an error that can be understandable
I’m getting now an issues for python
as below, I’m in doubt if it goes inside the directory in correct way
============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-8.0.0, pluggy-1.4.0
rootdir: /home/circleci/project
collected 0 items / 1 error
==================================== ERRORS ====================================
____ ERROR collecting api/tests/test_customers/test_individual_customers.py ____
ImportError while importing test module '/home/circleci/project/api/tests/test_customers/test_individual_customers.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../.pyenv/versions/3.11.7/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
api/tests/test_customers/test_individual_customers.py:2: in <module>
from utils.common_functions import *
api/utils/common_functions.py:3: in <module>
from multipledispatch import dispatch
E ModuleNotFoundError: No module named 'multipledispatch'
=========================== short test summary info ============================
ERROR api/tests/test_customers/test_individual_customers.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.16s ===============================
Exited with code exit status 2
YAML FILE
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
api_test:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Run tests
command: |
pwd
pip install requests
pip install -U pytest
python -m pytest
ui_test_dashboard:
docker:
- image: mcr.microsoft.com/playwright:v1.39.0-jammy
working_directory: ~/ui/dashboard/app
steps:
- checkout
- run:
command: |
pwd
npm i -D @playwright/test
npx playwright install
- run:
name: run tests
command: |
pwd
npx playwright test --config=./playwright.config.ts
ui_test_chcekout:
docker:
- image: mcr.microsoft.com/playwright:v1.39.0-jammy
working_directory: ~/ui/checkout_preact/app
steps:
- checkout
- run:
command: |
npm i -D @playwright/test
npx playwright install
- run:
name: run tests
command: |
npx playwright test
workflows:
version: 2
build:
jobs:
- api_test
- ui_test_dashboard
# - ui_test_chcekout
From the detailed error you have posted I would say, try adding the following line
pip install multipledispatch
The error is being thrown because of something within the python environment and that is likely a module mismatch between any working environment you have and the one provided by the CircleCI python environment.