checks: run impure pytest tests in CI pipeline
This commit is contained in:
parent
9cff6a39e8
commit
0ee6de86af
|
@ -2,6 +2,30 @@
|
|||
perSystem = { pkgs, lib, self', ... }:
|
||||
let
|
||||
impureChecks = {
|
||||
clan-pytest-impure = pkgs.writeShellScriptBin "clan-pytest-impure" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
export TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d)
|
||||
trap "${pkgs.coreutils}/bin/chmod -R +w '$TMPDIR'; ${pkgs.coreutils}/bin/rm -rf '$TMPDIR'" EXIT
|
||||
|
||||
export PATH="${lib.makeBinPath [
|
||||
pkgs.coreutils
|
||||
pkgs.gitMinimal
|
||||
pkgs.nix
|
||||
self'.packages.clan-cli.checkPython
|
||||
]}"
|
||||
|
||||
export CLAN_CORE=$TMPDIR/CLAN_CORE
|
||||
cp -r ${self} $CLAN_CORE
|
||||
chmod +w -R $CLAN_CORE
|
||||
|
||||
cp -r ${self'.packages.clan-cli.src} $TMPDIR/src
|
||||
chmod +w -R $TMPDIR/src
|
||||
cd $TMPDIR/src
|
||||
|
||||
python -m pytest -m "impure" -s ./tests --workers "" "$@"
|
||||
'';
|
||||
check-clan-template = pkgs.writeShellScriptBin "check-clan-template" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -euo pipefail
|
||||
|
@ -55,7 +79,7 @@
|
|||
set -euo pipefail
|
||||
${lib.concatMapStringsSep "\n" (name: ''
|
||||
echo -e "\n\nrunning check ${name}\n"
|
||||
${impureChecks.${name}}/bin/*
|
||||
${impureChecks.${name}}/bin/* "$@"
|
||||
'') (lib.attrNames impureChecks)}
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -104,6 +104,7 @@ python3.pkgs.buildPythonPackage {
|
|||
touch $out
|
||||
'';
|
||||
passthru.nixpkgs = nixpkgs;
|
||||
passthru.checkPython = checkPython;
|
||||
|
||||
passthru.devDependencies = [
|
||||
setuptools
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
TEST_ROOT = Path(__file__).parent.resolve()
|
||||
PROJECT_ROOT = TEST_ROOT.parent
|
||||
CLAN_CORE = PROJECT_ROOT.parent.parent
|
||||
|
||||
CLAN_CORE_ = os.environ.get("CLAN_CORE")
|
||||
if CLAN_CORE_:
|
||||
CLAN_CORE = Path(CLAN_CORE_)
|
||||
else:
|
||||
CLAN_CORE = PROJECT_ROOT.parent.parent
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
Loading…
Reference in New Issue
Block a user