python3Packages.sanic-testing: extract tests into passthru.pytest
Previously the pytestCheckHook had no meaning, since the tests were always executed using by other means. Extracting the tests into a dedicated package has become the standard way to escape infinite recursion issues and offers a cleaner approach here.
This commit is contained in:
parent
abb594d433
commit
5035d7b650
|
@ -1,11 +1,10 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, pytestCheckHook
|
||||
, httpx
|
||||
, pytest-asyncio
|
||||
, sanic
|
||||
, websockets
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
|
@ -35,18 +34,18 @@ buildPythonPackage rec {
|
|||
websockets
|
||||
];
|
||||
|
||||
checkInputs = [
|
||||
pytest-asyncio
|
||||
pytestCheckHook
|
||||
];
|
||||
postInstall = ''
|
||||
mkdir $testsout
|
||||
cp -R tests $testsout/tests
|
||||
'';
|
||||
|
||||
# `sanic` is explicitly set to null when building `sanic` itself
|
||||
# to prevent infinite recursion. In that case we skip running
|
||||
# the package at all.
|
||||
doCheck = sanic != null;
|
||||
dontUsePythonImportsCheck = sanic == null;
|
||||
# check in passthru.tests.pytest to escape infinite recursion with sanic
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "sanic_testing" ];
|
||||
passthru.tests = {
|
||||
pytest = callPackage ./tests.nix { };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Core testing clients for the Sanic web framework";
|
||||
|
|
26
pkgs/development/python-modules/sanic-testing/tests.nix
Normal file
26
pkgs/development/python-modules/sanic-testing/tests.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ buildPythonPackage
|
||||
, sanic
|
||||
, sanic-testing
|
||||
, pytest-asyncio
|
||||
, pytestCheckHook
|
||||
}:
|
||||
|
||||
buildPythonPackage {
|
||||
pname = "sanic-testing-tests";
|
||||
inherit (sanic-testing) version;
|
||||
|
||||
src = sanic-testing.testsout;
|
||||
|
||||
dontBuild = true;
|
||||
dontInstall = true;
|
||||
|
||||
checkInputs = [
|
||||
pytest-asyncio
|
||||
pytestCheckHook
|
||||
sanic
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"sanic_testing"
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue