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

This commit is contained in:
Emily 2024-11-13 12:11:44 +00:00 committed by GitHub
commit 70bad31fbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 18 additions and 35 deletions

View File

@ -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"

View File

@ -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";

View File

@ -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)

View File

@ -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"

View File

@ -24,7 +24,8 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ];
pytestFlagsArray = [ "$out/${python.sitePackages}" ];
preCheck = "pushd $out";
postCheck = "popd";
disabledTests = [ "test_make_c_files" ];

View File

@ -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";

View File

@ -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" ];

View File

@ -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" ];

View File

@ -27,7 +27,7 @@ buildPythonPackage rec {
reprshed
];
pytestFlagsArray = [ "$src/test.py" ];
pytestFlagsArray = [ "test.py" ];
meta = with lib; {
homepage = "https://github.com/mentalisttraceur/python-macaddress";

View File

@ -148,8 +148,6 @@ buildPythonPackage rec {
pytestFlagsArray = [
"-v"
"-n"
"$NIX_BUILD_CORES"
# Follow upstream with settings
"-m 'not serial'"
"--hypothesis-profile ci"

View File

@ -20,7 +20,7 @@ buildPythonPackage {
unittestFlagsArray = [
"-s"
"$src/test"
"test"
"-p"
"'*test.py'"
];