filter out test files from clan-cli source
this means we can fix test without having to re-run the installation tests.
This commit is contained in:
@@ -58,13 +58,16 @@ let
|
|||||||
(pythonRuntime.withPackages pyTestDeps)
|
(pythonRuntime.withPackages pyTestDeps)
|
||||||
];
|
];
|
||||||
|
|
||||||
source =
|
nixFilter = import ../../lib/filter-clan-core/nix-filter.nix;
|
||||||
|
|
||||||
|
cliSource =
|
||||||
|
source:
|
||||||
runCommand "clan-cli-source"
|
runCommand "clan-cli-source"
|
||||||
{
|
{
|
||||||
nativeBuildInputs = [ jq ];
|
nativeBuildInputs = [ jq ];
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
cp -r ${./.} $out
|
cp -r ${source} $out
|
||||||
chmod -R +w $out
|
chmod -R +w $out
|
||||||
|
|
||||||
# In cases where the devshell created this file, this will already exist
|
# In cases where the devshell created this file, this will already exist
|
||||||
@@ -78,6 +81,19 @@ let
|
|||||||
cp -r ${../../templates} $out/clan_cli/templates
|
cp -r ${../../templates} $out/clan_cli/templates
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
sourceWithoutTests = cliSource (
|
||||||
|
nixFilter.filter {
|
||||||
|
root = ./.;
|
||||||
|
include = [
|
||||||
|
(
|
||||||
|
_root: path: _type:
|
||||||
|
(builtins.match "test_.*\.py" path) == null
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
sourceWithTests = cliSource ./.;
|
||||||
|
|
||||||
# Create a custom nixpkgs for use within the project
|
# Create a custom nixpkgs for use within the project
|
||||||
nixpkgs' =
|
nixpkgs' =
|
||||||
runCommand "nixpkgs"
|
runCommand "nixpkgs"
|
||||||
@@ -106,7 +122,7 @@ let
|
|||||||
in
|
in
|
||||||
pythonRuntime.pkgs.buildPythonApplication {
|
pythonRuntime.pkgs.buildPythonApplication {
|
||||||
name = "clan-cli";
|
name = "clan-cli";
|
||||||
src = source;
|
src = sourceWithoutTests;
|
||||||
format = "pyproject";
|
format = "pyproject";
|
||||||
|
|
||||||
# Arguments for the wrapper to unset LD_LIBRARY_PATH to avoid glibc version issues
|
# Arguments for the wrapper to unset LD_LIBRARY_PATH to avoid glibc version issues
|
||||||
@@ -150,7 +166,7 @@ pythonRuntime.pkgs.buildPythonApplication {
|
|||||||
}
|
}
|
||||||
''
|
''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cp -r ${source} ./src
|
cp -r ${sourceWithTests} ./src
|
||||||
chmod +w -R ./src
|
chmod +w -R ./src
|
||||||
cd ./src
|
cd ./src
|
||||||
|
|
||||||
@@ -193,7 +209,7 @@ pythonRuntime.pkgs.buildPythonApplication {
|
|||||||
}
|
}
|
||||||
''
|
''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cp -r ${source} ./src
|
cp -r ${sourceWithTests} ./src
|
||||||
chmod +w -R ./src
|
chmod +w -R ./src
|
||||||
cd ./src
|
cd ./src
|
||||||
|
|
||||||
@@ -246,7 +262,7 @@ pythonRuntime.pkgs.buildPythonApplication {
|
|||||||
}
|
}
|
||||||
''
|
''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cp -r ${source} ./src
|
cp -r ${sourceWithTests} ./src
|
||||||
chmod +w -R ./src
|
chmod +w -R ./src
|
||||||
cd ./src
|
cd ./src
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user