Add checks

This commit is contained in:
Andreas Zweili 2022-11-27 21:20:24 +01:00
parent b267dcc6e7
commit a45c29c591
1 changed files with 35 additions and 0 deletions

View File

@ -41,8 +41,43 @@
export DJANGO_SETTINGS_MODULE=network_inventory.settings.local
'';
};
checks.lint = pkgs.stdenv.mkDerivation {
dontPatch = true;
dontConfigure = true;
dontBuild = true;
dontInstall = true;
doCheck = true;
name = "lint";
src = ./.;
checkInputs = [ pkgs.inventoryEnv ];
checkPhase = ''
mkdir -p $out
flake8 . --count --show-source --statistics | tee $out/test.log
'';
};
checks.tests = pkgs.stdenv.mkDerivation {
dontPatch = true;
dontConfigure = true;
dontBuild = true;
dontInstall = true;
doCheck = true;
name = "test";
src = ./.;
checkInputs = [ pkgs.inventoryEnv ];
checkPhase = ''
mkdir -p $out
pytest --ds=network_inventory.settings.ram_test \
-nauto \
--nomigrations \
--cov=./src \
--cov-report=html \
./src
cp -r htmlcov $out/
'';
};
packages.venv = pkgs.inventoryEnv;
packages.inventory = pkgs.inventoryPackage;
packages.default = pkgs.inventoryPackage;
}));
}