From 0ad2532e0424d3407718e33cf71cb0449c5ff6f7 Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Tue, 18 Jul 2023 20:50:15 +0300 Subject: [PATCH] Added code validation targets Signed-off-by: Andrey Berezin --- .gitignore | 2 +- Makefile | 31 ++++++++++++++++++++++--------- requirements_dev.txt | 3 ++- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index f955749..6a6674d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ .idea .DS_Store - +venv.* venv_macos diff --git a/Makefile b/Makefile index e9a37df..6f23a65 100644 --- a/Makefile +++ b/Makefile @@ -4,26 +4,39 @@ VENV_NAME = frostfs-testcases-${PYTHON_VERSION} VENV_DIR := venv.${VENV_NAME} current_dir := $(shell pwd) +FROM_VENV := . ${VENV_DIR}/bin/activate && venv: create requirements paths precommit @echo Ready precommit: @echo Isntalling pre-commit hooks - . ${VENV_DIR}/bin/activate && pre-commit install + ${FROM_VENV} pre-commit install paths: @echo Append paths for project @echo Virtual environment: ${VENV_DIR} - @sudo rm -rf ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth - @sudo touch ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth - @echo ${current_dir} | sudo tee ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth + @rm -rf ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth + @touch ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth + @echo ${current_dir} | tee ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth -create: - @echo Create virtual environment for - virtualenv --python=python${PYTHON_VERSION} --prompt=${VENV_NAME} ${VENV_DIR} +create: ${VENV_DIR} + +${VENV_DIR}: + @echo Create virtual environment ${VENV_DIR} + virtualenv --python=python${PYTHON_VERSION} --prompt=frostfs-testlib ${VENV_DIR} requirements: @echo Isntalling pip requirements - . ${VENV_DIR}/bin/activate && pip install -e ../frostfs-testlib - . ${VENV_DIR}/bin/activate && pip install -Ur pytest_tests/requirements.txt \ No newline at end of file + ${FROM_VENV} pip install -e ../frostfs-testlib + ${FROM_VENV} pip install -Ur requirements.txt + ${FROM_VENV} pip install -Ur requirements_dev.txt + + +#### VALIDATION SECTION #### +lint: create requirements + ${FROM_VENV} pip install -e ../frostfs-testlib; + ${FROM_VENV} pylint --disable R,C,W pytest_tests + +validation: lint + ${FROM_VENV} pytest --collect-only \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index 125455f..d0db337 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,2 +1,3 @@ pre-commit==2.20.0 -isort==5.12.0 \ No newline at end of file +isort==5.12.0 +pylint==2.17.4 \ No newline at end of file