Yueh-Shun Li 76e2a397c2 treewide: pytestFlagsArray -> pytestFlags and join flag and option argument
This treewide change targets Python packages
that specifies pytest flags with pytestFlagsArray,
and whose flags cannot be consructed by other pytestCheckHook-honoured arguments.

Use the __structuredAttrs-agnostic argument pytestFlags
instead of the deprecated pytestFlagsArray.

For flags with option arguments,
join each flag and their option argument into a single command-line argument
following POSIX Utility Argument Syntax[1]
for easier overriding (remove/replace).

Examples:

* [ "-W" "ignore:message:WarningClass" ] ->
  [ "-Wignore:message:WarningClass" ]

* [ "--reruns" "3" ] ->
  [ "--reruns=3" ]

[1]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html
2025-06-16 01:02:16 +08:00

59 lines
1.3 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
hatch-vcs,
hatchling,
gitMinimal,
importlib-metadata,
pydantic,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "pydantic-compat";
version = "0.1.2";
pyproject = true;
src = fetchFromGitHub {
owner = "pyapp-kit";
repo = "pydantic-compat";
tag = "v${version}";
leaveDotGit = true;
hash = "sha256-YJUfWu+nyGlwpJpxYghCKzj3CasdAaqYoNVCcfo/7YE=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [
gitMinimal
];
dependencies = [
importlib-metadata
pydantic
];
pythonImportsCheck = [ "pydantic_compat" ];
nativeCheckInputs = [ pytestCheckHook ];
pytestFlags = [
# pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is
# deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from
# the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
"-Wignore::pydantic.warnings.PydanticDeprecatedSince211"
];
meta = {
description = "Compatibility layer for pydantic v1/v2";
homepage = "https://github.com/pyapp-kit/pydantic-compat";
changelog = "https://github.com/pyapp-kit/pydantic-compat/releases/tag/v${version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ fab ];
};
}