Make sure conda tests run with conda.

This commit is contained in:
Tom Prince 2022-02-09 17:57:50 -07:00
parent 014f915869
commit aba66a51b5
5 changed files with 29 additions and 37 deletions

View file

@ -124,11 +124,11 @@
git
nixFlakes
parallel
bash
]
++ pkgs.lib.optional (stdenv.isLinux) busybox
++ pkgs.lib.optionals (stdenv.isDarwin) [
coreutils
(pkgs.runCommand "bin-sh" {} "mkdir -p $out/bin && ln -s ${pkgs.bash}/bin/bash $out/bin/sh")
])}"
cd tests

View file

@ -1,35 +1,8 @@
with builtins;
let
mach-nix = import ../. {};
conda = (getEnv "CONDA_TESTS") != "";
makeTest = file:
import file ({
inherit mach-nix;
} // (if conda then (rec {
baseArgsMkPython = { _provierDefaults = (fromTOML (readFile ./mach_nix/provider_defaults.toml) // {
_default = "conda,wheel,sdist,nixpkgs";
}); };
baseArgsBuildPythonPackage = baseArgsMkPython;
}) else {
baseArgsMkPython = { _provierDefaults = fromTOML (readFile ./mach_nix/provider_defaults.toml); };
baseArgsBuildPythonPackage = baseArgsMkPython;
}));
lib = mach-nix.nixpkgs.lib;
makeTests = import ./make-tests.nix;
testNames = lib.mapAttrsToList (n: v: lib.removeSuffix ".nix" n) (lib.filterAttrs (n: v: lib.hasPrefix "test_" n && lib.hasSuffix ".nix" n) (builtins.readDir ./.));
in
flatten (map (file: makeTests) [
./test_alias_dateutil.nix
./test_circular_deps.nix
./test_dot_in_name.nix
./test_extra_pkgs.nix
./test_extras.nix
./test_flakes.nix
./test_jupyterlab_nixpkgs.nix
./test_lazy_usage.nix
./test_non_python_extra_pkgs.nix
./test_overrides_selectPkgs.nix
./test_passthru_select_pypi_pname.nix
./test_py38_cp38_wheel.nix
./test_pymc3.nix
./test_r_pkgs.nix
./test_underscore_override.nix
./test_underscore_override_extra.nix
])
lib.flatten (map (name: makeTests { file = ./${name}.nix; }) testNames)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
set -euxo pipefail
WORKERS=${WORKERS:-10}
ls ./test_* | parallel -a - -j $WORKERS --halt now,fail=1 nix-build --no-out-link --show-trace
find . -name "test_*.nix" | parallel -a - -j "${WORKERS}" --halt now,fail=1 nix-build --no-out-link --show-trace make-tests.nix --arg file

18
tests/make-tests.nix Normal file
View file

@ -0,0 +1,18 @@
with builtins;
let
mach-nix = import ../. {};
lib = mach-nix.nixpkgs.lib;
conda = (getEnv "CONDA_TESTS") != "";
makeTests = {file}:
import file ({
inherit mach-nix;
} // (if conda then (rec {
baseArgsMkPython = { _providerDefaults = (fromTOML (readFile ../mach_nix/provider_defaults.toml) // {
_default = "conda,wheel,sdist,nixpkgs";
}); };
baseArgsBuildPythonPackage = baseArgsMkPython;
}) else rec {
baseArgsMkPython = { _providerDefaults = fromTOML (readFile ../mach_nix/provider_defaults.toml); };
baseArgsBuildPythonPackage = baseArgsMkPython;
}));
in makeTests

View file

@ -1,11 +1,10 @@
{
mach-nix ? import ../. {
python = "python38";
},
mach-nix ? import ../. {},
...
}:
with builtins;
mach-nix.mkPython {
python = "python38";
requirements = ''
numba==0.50.1
'';