Fix(tests): fix failing pytests
This commit is contained in:
@@ -7,10 +7,3 @@ from clan_lib.bwrap import bubblewrap_works
|
||||
@pytest.mark.skipif(sys.platform != "linux", reason="bubblewrap only works on linux")
|
||||
def test_bubblewrap_works_on_linux() -> None:
|
||||
assert bubblewrap_works() is True
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
sys.platform == "linux", reason="bubblewrap does not work on non-linux"
|
||||
)
|
||||
def test_bubblewrap_detection_non_linux() -> None:
|
||||
assert bubblewrap_works() is False
|
||||
|
||||
@@ -39,6 +39,8 @@ class MockFlake:
|
||||
output = subprocess.run(
|
||||
[
|
||||
"nix",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
"eval",
|
||||
"--impure",
|
||||
"--json",
|
||||
|
||||
@@ -176,36 +176,7 @@ pythonRuntime.pkgs.buildPythonApplication {
|
||||
# limit build cores to 16
|
||||
jobs="$((NIX_BUILD_CORES>16 ? 16 : NIX_BUILD_CORES))"
|
||||
|
||||
python -m pytest -m "not impure and not with_core" -n $jobs ./clan_cli/tests
|
||||
touch $out
|
||||
'';
|
||||
clan-lib-pytest-without-core =
|
||||
runCommand "clan-lib-pytest-without-core"
|
||||
{
|
||||
nativeBuildInputs = testDependencies;
|
||||
closureInfo = pkgs.closureInfo {
|
||||
rootPaths = [
|
||||
templateDerivation
|
||||
];
|
||||
};
|
||||
}
|
||||
''
|
||||
set -euo pipefail
|
||||
cp -r ${sourceWithTests} ./src
|
||||
chmod +w -R ./src
|
||||
cd ./src
|
||||
|
||||
export NIX_STATE_DIR=$TMPDIR/nix IN_NIX_SANDBOX=1 PYTHONWARNINGS=error
|
||||
|
||||
# required to prevent concurrent 'nix flake lock' operations
|
||||
export CLAN_TEST_STORE=$TMPDIR/store
|
||||
export LOCK_NIX=$TMPDIR/nix_lock
|
||||
mkdir -p "$CLAN_TEST_STORE/nix/store"
|
||||
|
||||
# limit build cores to 16
|
||||
jobs="$((NIX_BUILD_CORES>16 ? 16 : NIX_BUILD_CORES))"
|
||||
|
||||
python -m pytest -m "not impure and not with_core" -n $jobs ./clan_lib
|
||||
python -m pytest -m "not impure and not with_core" -n $jobs ./clan_cli ./clan_lib
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user