about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pbr
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pbr')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pbr/default.nix22
-rw-r--r--nixpkgs/pkgs/development/python-modules/pbr/tests.nix49
2 files changed, 67 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pbr/default.nix b/nixpkgs/pkgs/development/python-modules/pbr/default.nix
index 9ce3d72a20d9..77e8d5c210a2 100644
--- a/nixpkgs/pkgs/development/python-modules/pbr/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/pbr/default.nix
@@ -1,4 +1,9 @@
-{ lib, buildPythonPackage, fetchPypi }:
+{ lib
+, buildPythonPackage
+, fetchPypi
+, setuptools
+, callPackage
+}:
 
 buildPythonPackage rec {
   pname = "pbr";
@@ -9,12 +14,21 @@ buildPythonPackage rec {
     sha256 = "42df03e7797b796625b1029c0400279c7c34fd7df24a7d7818a1abb5b38710dd";
   };
 
-  # circular dependencies with fixtures
+  propagatedBuildInputs = [ setuptools ];
+
+  # check in passthru.tests.pytest to escape infinite recursion with fixtures
   doCheck = false;
 
+  passthru.tests = {
+    tests = callPackage ./tests.nix { };
+  };
+
+  pythonImportsCheck = [ "pbr" ];
+
   meta = with lib; {
-    homepage = "http://docs.openstack.org/developer/pbr/";
-    license = licenses.asl20;
     description = "Python Build Reasonableness";
+    homepage = "https://github.com/openstack/pbr";
+    license = licenses.asl20;
+    maintainers = teams.openstack.members;
   };
 }
diff --git a/nixpkgs/pkgs/development/python-modules/pbr/tests.nix b/nixpkgs/pkgs/development/python-modules/pbr/tests.nix
new file mode 100644
index 000000000000..a1c57684ce46
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pbr/tests.nix
@@ -0,0 +1,49 @@
+{ stdenv
+, buildPythonPackage
+, git
+, gnupg
+, pbr
+, mock
+, sphinx
+, stestr
+, testresources
+, testscenarios
+, virtualenv
+}:
+
+buildPythonPackage rec {
+  pname = "pbr";
+  inherit (pbr) version;
+
+  src = pbr.src;
+
+  postPatch = ''
+    # only a small portion of the listed packages are actually needed for running the tests
+    # so instead of removing them one by one remove everything
+    rm test-requirements.txt
+  '';
+
+  dontBuild = true;
+  dontInstall = true;
+
+  checkInputs = [
+    pbr
+    git
+    gnupg
+    mock
+    sphinx
+    stestr
+    testresources
+    testscenarios
+    virtualenv
+  ];
+
+  checkPhase = ''
+    stestr run -e <(echo "
+    pbr.tests.test_core.TestCore.test_console_script_develop
+    pbr.tests.test_core.TestCore.test_console_script_install
+    pbr.tests.test_wsgi.TestWsgiScripts.test_with_argument
+    pbr.tests.test_wsgi.TestWsgiScripts.test_wsgi_script_run
+    ")
+  '';
+}