Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/check_n_push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ jobs:
make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}
docker image save --output /tmp/codeplag-ubuntu22.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@v1
with:
pytest-xml-coverage-path: ./test/unit/pytest-coverage.xml

- name: Run autotests
run: |
export $(cat .env | xargs)
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# Environment variables
.env

# Developmnt environmemt
# Development and environment
.vscode
.python-version
docs/notebooks/.ipynb_checkpoints/
test/unit/pytest-coverage.xml

# Build
__pycache__
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UTIL_VERSION := 0.5.14
UTIL_VERSION := 0.5.15
UTIL_NAME := codeplag
PWD := $(shell pwd)

Expand Down Expand Up @@ -33,6 +33,7 @@ DOCKER_SUB_FILES := docker/base_ubuntu2204.dockerfile \

PYTHON_REQUIRED_LIBS := $(shell python3 setup.py --install-requirements)
PYTHON_BUILD_LIBS := $(shell python3 setup.py --build-requirements)
PYTHON_TEST_LIBS := $(shell python3 setup.py --test-requirements)


ifeq ($(IS_DEVELOPED), 1)
Expand All @@ -49,6 +50,7 @@ substitute = @sed \
-e "s|@DEVEL_SUFFIX@|${DEVEL_SUFFIX}|g" \
-e "s|@PYTHON_REQUIRED_LIBS@|${PYTHON_REQUIRED_LIBS}|g" \
-e "s|@PYTHON_BUILD_LIBS@|${PYTHON_BUILD_LIBS}|g" \
-e "s|@PYTHON_TEST_LIBS@|${PYTHON_TEST_LIBS}|g" \
-e "s|@LOGS_PATH@|${LOGS_PATH}|g" \
-e "s|@LIB_PATH@|${LIB_PATH}|g" \
-e "s|@CONFIG_PATH@|${CONFIG_PATH}|g" \
Expand Down Expand Up @@ -127,12 +129,11 @@ package: substitute-debian
)

test: substitute-sources
pytest test/unit -vv
pytest test/misc -vv
pytest test/unit test/misc --cov=src/ --cov-report xml --cov-report term
make clean-cache

autotest:
pytest test/auto -vv
pytest test/auto
make clean-cache

pre-commit:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

- Testing for analyzers with pytest lib (required preinstalled pytest framework).
```
$ pip3 install pytest==8.3.4 pytest-mock==3.14.0
$ pip3 install $(python3 setup.py --test-requirements)
$ make test
```

Expand Down
3 changes: 2 additions & 1 deletion docker/test_ubuntu2204.dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y debhelper
RUN pip3 install pytest==8.3.4 pytest-mock==3.14.0 @PYTHON_BUILD_LIBS@
RUN pip3 install @PYTHON_TEST_LIBS@ @PYTHON_BUILD_LIBS@
RUN mkdir -p @LOGS_PATH@

# TODO: Move to middle docker file or make another solution
ADD setup.py /usr/src/@UTIL_NAME@/setup.py
ADD pyproject.toml /usr/src/@UTIL_NAME@/pyproject.toml
ADD src/ /usr/src/@UTIL_NAME@/src
ADD README.md /usr/src/@UTIL_NAME@/README.md
ADD LICENSE /usr/src/@UTIL_NAME@/LICENSE
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,22 @@ typeCheckingMode = "basic"

[build-system]
requires = ["setuptools", "Cython"]

[tool.coverage.run]
branch = true

[tool.coverage.report]
include_namespace_packages = true
precision = 2

[tool.coverage.xml]
output = "test/unit/pytest-coverage.xml"

[tool.pytest.ini_options]
addopts = "-vv"
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
pythonpath = [
"src",
]
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"setuptools~=75.8.1",
"Jinja2~=3.1.5",
)
TEST_REQUIREMENTS: tuple[str, ...] = (
"pytest~=8.3.4",
"pytest-mock~=3.14.0",
"pytest-cov~=6.0.0",
)
INSTALL_REQUIREMENTS: tuple[str, ...] = (
"argcomplete~=3.5.3",
"numpy~=1.26.4",
Expand All @@ -32,6 +37,9 @@
if "--build-requirements" in sys.argv:
print(" ".join(BUILD_REQUIREMENTS))
sys.exit(0)
if "--test-requirements" in sys.argv:
print(" ".join(TEST_REQUIREMENTS))
sys.exit(0)
elif "--install-requirements" in sys.argv:
print(" ".join(INSTALL_REQUIREMENTS))
sys.exit(0)
Expand Down
Loading