File tree Expand file tree Collapse file tree 7 files changed +42
-7
lines changed
Expand file tree Collapse file tree 7 files changed +42
-7
lines changed Original file line number Diff line number Diff line change 6464 make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}
6565 docker image save --output /tmp/codeplag-ubuntu22.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}
6666
67+ - name : Pytest coverage comment
68+ uses : MishaKav/pytest-coverage-comment@v1
69+ with :
70+ pytest-xml-coverage-path : ./test/unit/pytest-coverage.xml
71+
6772 - name : Run autotests
6873 run : |
6974 export $(cat .env | xargs)
Original file line number Diff line number Diff line change 44# Environment variables
55.env
66
7- # Developmnt environmemt
7+ # Development and environment
88.vscode
99.python-version
1010docs /notebooks /.ipynb_checkpoints /
11+ test /unit /pytest-coverage.xml
1112
1213# Build
1314__pycache__
Original file line number Diff line number Diff line change 1- UTIL_VERSION := 0.5.14
1+ UTIL_VERSION := 0.5.15
22UTIL_NAME := codeplag
33PWD := $(shell pwd)
44
@@ -33,6 +33,7 @@ DOCKER_SUB_FILES := docker/base_ubuntu2204.dockerfile \
3333
3434PYTHON_REQUIRED_LIBS := $(shell python3 setup.py --install-requirements)
3535PYTHON_BUILD_LIBS := $(shell python3 setup.py --build-requirements)
36+ PYTHON_TEST_LIBS := $(shell python3 setup.py --test-requirements)
3637
3738
3839ifeq ($(IS_DEVELOPED ) , 1)
@@ -49,6 +50,7 @@ substitute = @sed \
4950 -e "s|@DEVEL_SUFFIX@|${DEVEL_SUFFIX}|g" \
5051 -e "s|@PYTHON_REQUIRED_LIBS@|${PYTHON_REQUIRED_LIBS}|g" \
5152 -e "s|@PYTHON_BUILD_LIBS@|${PYTHON_BUILD_LIBS}|g" \
53+ -e "s|@PYTHON_TEST_LIBS@|${PYTHON_TEST_LIBS}|g" \
5254 -e "s|@LOGS_PATH@|${LOGS_PATH}|g" \
5355 -e "s|@LIB_PATH@|${LIB_PATH}|g" \
5456 -e "s|@CONFIG_PATH@|${CONFIG_PATH}|g" \
@@ -127,12 +129,11 @@ package: substitute-debian
127129 )
128130
129131test : substitute-sources
130- pytest test/unit -vv
131- pytest test/misc -vv
132+ pytest test/unit test/misc --cov=src/ --cov-report xml --cov-report term
132133 make clean-cache
133134
134135autotest :
135- pytest test/auto -vv
136+ pytest test/auto
136137 make clean-cache
137138
138139pre-commit :
Original file line number Diff line number Diff line change 103103
104104- Testing for analyzers with pytest lib (required preinstalled pytest framework).
105105 ```
106- $ pip3 install pytest==8.3.4 pytest-mock==3.14.0
106+ $ pip3 install $(python3 setup.py --test-requirements)
107107 $ make test
108108 ```
109109
Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ ENV DEBIAN_FRONTEND=noninteractive
44
55RUN apt-get update
66RUN apt-get install -y debhelper
7- RUN pip3 install pytest==8.3.4 pytest-mock==3.14.0 @PYTHON_BUILD_LIBS@
7+ RUN pip3 install @PYTHON_TEST_LIBS@ @PYTHON_BUILD_LIBS@
88RUN mkdir -p @LOGS_PATH@
99
1010# TODO: Move to middle docker file or make another solution
1111ADD setup.py /usr/src/@UTIL_NAME@/setup.py
12+ ADD pyproject.toml /usr/src/@UTIL_NAME@/pyproject.toml
1213ADD src/ /usr/src/@UTIL_NAME@/src
1314ADD README.md /usr/src/@UTIL_NAME@/README.md
1415ADD LICENSE /usr/src/@UTIL_NAME@/LICENSE
Original file line number Diff line number Diff line change @@ -59,3 +59,22 @@ typeCheckingMode = "basic"
5959
6060[build-system ]
6161requires = [" setuptools" , " Cython" ]
62+
63+ [tool .coverage .run ]
64+ branch = true
65+
66+ [tool .coverage .report ]
67+ include_namespace_packages = true
68+ precision = 2
69+
70+ [tool .coverage .xml ]
71+ output = " test/unit/pytest-coverage.xml"
72+
73+ [tool .pytest .ini_options ]
74+ addopts = " -vv"
75+ python_files = [" test_*.py" ]
76+ python_classes = [" Test*" ]
77+ python_functions = [" test_*" ]
78+ pythonpath = [
79+ " src" ,
80+ ]
Original file line number Diff line number Diff line change 99 "setuptools~=75.8.1" ,
1010 "Jinja2~=3.1.5" ,
1111)
12+ TEST_REQUIREMENTS : tuple [str , ...] = (
13+ "pytest~=8.3.4" ,
14+ "pytest-mock~=3.14.0" ,
15+ "pytest-cov~=6.0.0" ,
16+ )
1217INSTALL_REQUIREMENTS : tuple [str , ...] = (
1318 "argcomplete~=3.5.3" ,
1419 "numpy~=1.26.4" ,
3237if "--build-requirements" in sys .argv :
3338 print (" " .join (BUILD_REQUIREMENTS ))
3439 sys .exit (0 )
40+ if "--test-requirements" in sys .argv :
41+ print (" " .join (TEST_REQUIREMENTS ))
42+ sys .exit (0 )
3543elif "--install-requirements" in sys .argv :
3644 print (" " .join (INSTALL_REQUIREMENTS ))
3745 sys .exit (0 )
You can’t perform that action at this time.
0 commit comments