Files
nixpkgs/pkgs/development/python-modules/pytest-forked/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

76 lines
1.6 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
pythonOlder,
pythonAtLeast,
fetchFromGitHub,
fetchpatch2,
setuptools,
setuptools-scm,
wheel,
py,
pytest,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "pytest-forked";
version = "1.6.0";
disabled = pythonOlder "3.7";
format = "pyproject";
src = fetchFromGitHub {
owner = "pytest-dev";
repo = "pytest-forked";
rev = "refs/tags/v${version}";
hash = "sha256-owkGwF5WQ17/CXwTsIYJ2AgktekRB4qhtsDxR0LCI/k=";
};
patches = [
(fetchpatch2 {
# https://github.com/pytest-dev/pytest-forked/actions
name = "pytest8-compat.patch";
url = "https://github.com/pytest-dev/pytest-forked/commit/b2742322d39ebda97d5170922520f3bb9c73f614.patch";
hash = "sha256-tTRW0p3tOotQMtjjJ6RUKdynsAnKRz0RAV8gAUHiNNA=";
})
];
nativeBuildInputs = [
setuptools
setuptools-scm
wheel
];
buildInputs = [ pytest ];
propagatedBuildInputs = [ py ];
nativeCheckInputs = [
py
pytestCheckHook
];
disabledTests =
if (pythonAtLeast "3.12" && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) then
[
# non reproducible test failure on hydra, works on community builder
# https://hydra.nixos.org/build/252537267
"test_xfail"
]
else
null;
setupHook = ./setup-hook.sh;
meta = {
changelog = "https://github.com/pytest-dev/pytest-forked/blob/${src.rev}/CHANGELOG.rst";
description = "Run tests in isolated forked subprocesses";
homepage = "https://github.com/pytest-dev/pytest-forked";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dotlambda ];
};
}