From d7f6081cd682446f5f6c8b2cbef999fe6c9d290d Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Wed, 9 Feb 2022 17:59:08 -0700 Subject: [PATCH] Fix unit test execution in CI. This switches to using `python -m pytest`, which causes the current directory to be added to the python path. --- flake.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index c234113..008468d 100644 --- a/flake.nix +++ b/flake.nix @@ -103,7 +103,6 @@ # busybox does). ++ pkgs.lib.optionals (stdenv.isDarwin) [ coreutils - (pkgs.runCommand "bin-sh" {} "mkdir -p $out/bin && ln -s ${pkgs.bash}/bin/bash $out/bin/sh") ])}" export PYPI_DATA=${inp.pypi-deps-db} @@ -112,8 +111,10 @@ providers = { _default = [ "conda/main" "conda/r" "conda/conda-forge"]; }; }).condaChannelsJson} + # Use "python -m pytest" to add current directory to python path. + # This ensures that mach_nix is importable. echo "executing unit tests" - pytest -n $(nproc) -x ${./.} + python -m pytest -n ''${WORKERS:-$(nproc)} -x ${./.} ''); };