Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3Packages: don't depend on setup hooks' bash eval (part with fewer rebuilds) #354811

Merged
merged 10 commits into from
Nov 13, 2024
Merged
7 changes: 2 additions & 5 deletions pkgs/by-name/co/conan/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,11 @@ python3.pkgs.buildPythonApplication rec {
"conan"
];

pytestFlagsArray = [
"-n"
"$NIX_BUILD_CORES"
];

disabledTests = [
# Tests require network access
"TestFTP"
# Unstable test
"test_shared_windows_find_libraries"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
# Rejects paths containing nix
"test_conditional_os"
Expand Down
17 changes: 2 additions & 15 deletions pkgs/by-name/fi/fichub-cli/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,8 @@ python3Packages.buildPythonApplication rec {
pytestCheckHook
];

# The package tries to create a file under the home directory on import
preCheck = ''
export HOME=$(mktemp -d)
'';

pytestFlagsArray = [
# pytest exits with a code of 5 if no tests are selected.
# handle this specific case as not an error
"|| ([ $? = 5 ] || exit $?)"
];

disabledTestPaths = [
# Loading tests tries to download something from pypi.org
"tests/test_cli.py"
];
# Loading tests tries to download something from pypi.org
doCheck = false;

meta = {
description = "CLI for the fichub.net API";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/pi/picard/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pythonPackages.buildPythonApplication rec {
pyyaml
];

setupPyGlobalFlags = [ "build" "--disable-autoupdate" "--localedir=$out/share/locale" ];
setupPyGlobalFlags = [ "build" "--disable-autoupdate" "--localedir=${placeholder "out"}/share/locale" ];

preCheck = ''
export HOME=$(mktemp -d)
Expand Down
2 changes: 0 additions & 2 deletions pkgs/by-name/ro/routersploit/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ python3.pkgs.buildPythonApplication rec {
];

pytestFlagsArray = [
"-n"
"$NIX_BUILD_CORES"
# Run the same tests as upstream does in the first round
"tests/core/"
"tests/test_exploit_scenarios.py"
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/python-modules/bottleneck/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ buildPythonPackage rec {

nativeCheckInputs = [ pytestCheckHook ];

pytestFlagsArray = [ "$out/${python.sitePackages}" ];
preCheck = "pushd $out";
postCheck = "popd";

disabledTests = [ "test_make_c_files" ];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildPythonPackage rec {
# Doesn't have any tests
doCheck = false;

pytestCheckHook = [ "certbot_dns_inwx" ];
pytestImportsCheck = [ "certbot_dns_inwx" ];

meta = with lib; {
description = "INWX DNS Authenticator plugin for Certbot";
Expand Down
8 changes: 5 additions & 3 deletions pkgs/development/python-modules/dtw-python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ buildPythonPackage rec {
];

# We need to run tests on real built package: https://github.com/NixOS/nixpkgs/issues/255262
preCheck = "cd $out";
nativeCheckInputs = [ pytestCheckHook ];
# tests/ are not included to output package, so we have to set path explicitly
pytestFlagsArray = [ "$src/tests" ];
preCheck = ''
appendToVar pytestFlagsArray "$src/tests"
cd $out
'';
nativeCheckInputs = [ pytestCheckHook ];

pythonImportsCheck = [ "dtw" ];

Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/python-modules/iso4217/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ buildPythonPackage rec {
# The table is already downloaded
export ISO4217_DOWNLOAD=0
# Copy the table file to satifiy the build process
cp -r ${table} $pname/table.xml
cp -r ${table} iso4217/table.xml
'';

postInstall = ''
# Copy the table file
cp -r ${table} $out/${python.sitePackages}/$pname/table.xml
cp -r ${table} $out/${python.sitePackages}/iso4217/table.xml
'';

pytestFlagsArray = [ "$pname/test.py" ];
pytestFlagsArray = [ "iso4217/test.py" ];

pythonImportsCheck = [ "iso4217" ];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/macaddress/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildPythonPackage rec {
reprshed
];

pytestFlagsArray = [ "$src/test.py" ];
pytestFlagsArray = [ "test.py" ];

meta = with lib; {
homepage = "https://github.com/mentalisttraceur/python-macaddress";
Expand Down
2 changes: 0 additions & 2 deletions pkgs/development/python-modules/qcodes/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ buildPythonPackage rec {

pytestFlagsArray = [
"-v"
"-n"
"$NIX_BUILD_CORES"
# Follow upstream with settings
"-m 'not serial'"
"--hypothesis-profile ci"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/vapoursynth/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ buildPythonPackage {

unittestFlagsArray = [
"-s"
"$src/test"
"test"
"-p"
"'*test.py'"
];
Expand Down