mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-24 06:33:42 +00:00
3d568360e7
This resolves a circular dependency issue between pytest and attrs, by instead building a separate output that _just_ contains the tests from the original package, which is then consumed by a separate tests derivation. The downside of this approach is that these tests will not be run on Hydra. They're not being run on Hydra at the moment, either, since doCheck is false.
40 lines
813 B
Nix
40 lines
813 B
Nix
{ lib
|
|
, callPackage
|
|
, buildPythonPackage
|
|
, fetchPypi
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "attrs";
|
|
version = "21.2.0";
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
sha256 = "ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb";
|
|
};
|
|
|
|
outputs = [ "out" "testout" ];
|
|
|
|
postInstall = ''
|
|
# Install tests as the tests output.
|
|
mkdir $testout
|
|
cp -R tests $testout/tests
|
|
'';
|
|
|
|
pythonImportsCheck = [ "attr" ];
|
|
|
|
# pytest depends on attrs, so we can't do this out-of-the-box.
|
|
# Instead, we do this as a passthru.tests test.
|
|
doCheck = false;
|
|
|
|
passthru.tests = {
|
|
pytest = callPackage ./tests.nix { };
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Python attributes without boilerplate";
|
|
homepage = "https://github.com/hynek/attrs";
|
|
license = licenses.mit;
|
|
};
|
|
}
|