summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2021-09-12 22:07:48 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2021-09-12 22:08:27 +0200
commitbd6c0565b2947c58d951046ecfd4718489c9b515 (patch)
tree625c9bd0b4c595398547b679bedf1e5aa817349d
parenta13bf1828bf73e7db47c08e5e9819f7dd4b8dcd2 (diff)
downloadnixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.tar
nixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.tar.gz
nixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.tar.bz2
nixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.tar.lz
nixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.tar.xz
nixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.tar.zst
nixpkgs-bd6c0565b2947c58d951046ecfd4718489c9b515.zip
python39Packages.pbr: enable tests, adopt into openstack team
-rw-r--r--pkgs/development/python-modules/pbr/default.nix19
-rw-r--r--pkgs/development/python-modules/pbr/tests.nix49
2 files changed, 64 insertions, 4 deletions
diff --git a/pkgs/development/python-modules/pbr/default.nix b/pkgs/development/python-modules/pbr/default.nix
index 9c69e2fea54..9c46e638fc4 100644
--- a/pkgs/development/python-modules/pbr/default.nix
+++ b/pkgs/development/python-modules/pbr/default.nix
@@ -1,4 +1,9 @@
-{ lib, buildPythonPackage, fetchPypi, setuptools }:
+{ lib
+, buildPythonPackage
+, fetchPypi
+, setuptools
+, callPackage
+}:
 
 buildPythonPackage rec {
   pname = "pbr";
@@ -11,13 +16,19 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [ setuptools ];
 
-  # circular dependencies with fixtures
+  # check in passthru.tests.pytest to escape infinite recursion with fixtures
   doCheck = false;
+
+  passthru.tests = {
+    pytest = 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/pkgs/development/python-modules/pbr/tests.nix b/pkgs/development/python-modules/pbr/tests.nix
new file mode 100644
index 00000000000..a1c57684ce4
--- /dev/null
+++ b/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
+    ")
+  '';
+}