mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-25 17:55:21 +00:00
python3Packages.openapi-spec-validator: fix build & tests
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
{ lib, buildPythonPackage, isPy27, fetchPypi
|
||||
, jsonschema, openapi-schema-validator, pyyaml, six, pathlib
|
||||
, mock, pytest, pytest-cov, pytest-flake8, tox, setuptools
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, poetry-core
|
||||
|
||||
# propagates
|
||||
, jsonschema
|
||||
, openapi-schema-validator
|
||||
, pyyaml
|
||||
|
||||
# optional
|
||||
, requests
|
||||
|
||||
# tests
|
||||
, mock
|
||||
, pytestCheckHook
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@@ -10,17 +21,52 @@ buildPythonPackage rec {
|
||||
version = "0.4.0";
|
||||
format = "pyproject";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-l/JYhQr8l7BI98JlOFXg+I+masEDwr5Qd8eWCsoq1Jo=";
|
||||
# no tests via pypi sdist
|
||||
src = fetchFromGitHub {
|
||||
owner = "p1c2u";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
hash = "sha256-mGgHlDZTUo72RNZ/448gkGdza4EntYU9YoBpSKDUCeA=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ poetry-core ];
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace 'openapi-schema-validator = "^0.2.0"' 'openapi-schema-validator = "*"'
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [ jsonschema openapi-schema-validator pyyaml six setuptools requests ]
|
||||
++ (lib.optionals (isPy27) [ pathlib ]);
|
||||
nativeBuildInputs = [
|
||||
poetry-core
|
||||
];
|
||||
|
||||
checkInputs = [ mock pytest pytest-cov pytest-flake8 tox ];
|
||||
propagatedBuildInputs = [
|
||||
jsonschema
|
||||
openapi-schema-validator
|
||||
pyyaml
|
||||
];
|
||||
|
||||
passthru.optional-dependencies.requests = [
|
||||
requests
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
sed -i '/--cov/d' pyproject.toml
|
||||
'';
|
||||
|
||||
checkInputs = [
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# network access
|
||||
"test_default_valid"
|
||||
"test_urllib_valid"
|
||||
"test_valid"
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"openapi_spec_validator"
|
||||
"openapi_spec_validator.readers"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/p1c2u/openapi-spec-validator";
|
||||
|
||||
Reference in New Issue
Block a user