lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

python3Packages.attrs: separate test run into a separate tests attribute.

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.

authored by

Luke Granger-Brown and committed by
Jonathan Ringer
3d568360 fe2d2498

+39 -9
+18 -9
pkgs/development/python-modules/attrs/default.nix
··· 1 - { lib, stdenv, buildPythonPackage, fetchPypi, pytest, hypothesis, zope_interface 2 - , pympler, coverage, six, clang }: 1 + { lib 2 + , callPackage 3 + , buildPythonPackage 4 + , fetchPypi 5 + }: 3 6 4 7 buildPythonPackage rec { 5 8 pname = "attrs"; ··· 10 13 sha256 = "ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"; 11 14 }; 12 15 13 - # macOS needs clang for testing 14 - checkInputs = [ 15 - pytest hypothesis zope_interface pympler coverage six 16 - ] ++ lib.optionals (stdenv.isDarwin) [ clang ]; 16 + outputs = [ "out" "testout" ]; 17 17 18 - checkPhase = '' 19 - py.test 18 + postInstall = '' 19 + # Install tests as the tests output. 20 + mkdir $testout 21 + cp -R tests $testout/tests 20 22 ''; 21 23 22 - # To prevent infinite recursion with pytest 24 + pythonImportsCheck = [ "attr" ]; 25 + 26 + # pytest depends on attrs, so we can't do this out-of-the-box. 27 + # Instead, we do this as a passthru.tests test. 23 28 doCheck = false; 29 + 30 + passthru.tests = { 31 + pytest = callPackage ./tests.nix { }; 32 + }; 24 33 25 34 meta = with lib; { 26 35 description = "Python attributes without boilerplate";
+21
pkgs/development/python-modules/attrs/tests.nix
··· 1 + { buildPythonPackage 2 + , pytestCheckHook 3 + , attrs 4 + , hypothesis 5 + }: 6 + 7 + buildPythonPackage { 8 + pname = "attrs-tests"; 9 + inherit (attrs) version; 10 + 11 + srcs = attrs.testout; 12 + 13 + dontBuild = true; 14 + dontInstall = true; 15 + 16 + checkInputs = [ 17 + attrs 18 + hypothesis 19 + pytestCheckHook 20 + ]; 21 + }