1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

protobuf: Fix tests

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2024-03-26 23:43:49 +01:00 committed by pipeacosta
parent 0d54b1311a
commit 688e8fac82
5 changed files with 22 additions and 7 deletions

View file

@ -92,10 +92,10 @@ test:python:
stage: test
script:
- cd python
- /venv/bin/black --check .
- /venv/bin/pytest --verbose .
- /venv/bin/black --extend-exclude=".*(\\.pyi|_pb2.py)$" --check .
- /venv/bin/flake8 --extend-exclude="*.pyi,*_pb2.py" .
- /venv/bin/mypy .
- /venv/bin/flake8 .
- /venv/bin/pytest -v .
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
test:cppcheck:

View file

@ -149,6 +149,12 @@
name = "full";
inputsFrom = with pkgs; [villas];
};
python = pkgs.mkShell {
inherit shellHook hardeningDisable packages;
name = "full";
inputsFrom = with pkgs; [villas-python];
};
}
);

View file

@ -4,7 +4,6 @@
src,
pkgs,
python3Packages,
villas-minimal,
}:
python3Packages.buildPythonPackage {
name = "villas-python";
@ -24,11 +23,13 @@ python3Packages.buildPythonPackage {
mypy
pytest
types-requests
types-protobuf
mypy-protobuf
pytestCheckHook
];
postPatch = ''
${pkgs.protobuf}/bin/protoc --proto_path ${src}/lib/formats --python_out=villas/node/ ${src}/lib/formats/villas.proto
${pkgs.protobuf}/bin/protoc --proto_path ${src}/lib/formats --mypy_out=villas/node --python_out=villas/node/ ${src}/lib/formats/villas.proto
'';
}

View file

@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
use flake .#villas-python
use flake ..#python
watch_file ../flake.nix

View file

@ -23,6 +23,7 @@ classifiers = [
dependencies = [
'linuxfd==1.5',
'requests==2.31.0',
'protobuf==4.24.4',
]
optional-dependencies.dev = [
'black==24.2.0',
@ -30,7 +31,7 @@ optional-dependencies.dev = [
'mypy==1.8.0',
'pytest==8.0.0',
'types-requests==2.31.0.20240125',
'protobuf==4.24.4',
'types-protobuf==4.24.0.20240311',
]
[project.urls]
@ -45,3 +46,10 @@ email = 'post@steffenvogel.de'
[[project.authors]]
name = 'Philipp Jungkamp'
email = 'Philipp.Jungkamp@opal-rt.com'
[[tool.mypy.overrides]]
module = ['google']
ignore_missing_imports = true
[tool.black]
extend-exclude = '''.*(\.pyi|_pb2.py)$'''