From c9f961754b4dd43819a1be25a4ed00f33983c6a2 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Wed, 7 Aug 2024 14:34:51 -0400 Subject: [PATCH 1/2] python312Packages.lockfile: Remove usage of nose --- .../python-modules/lockfile/default.nix | 12 +++----- .../python-modules/lockfile/fix-tests.patch | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 pkgs/development/python-modules/lockfile/fix-tests.patch diff --git a/pkgs/development/python-modules/lockfile/default.nix b/pkgs/development/python-modules/lockfile/default.nix index 5423a1abb300f..e941da384efa3 100644 --- a/pkgs/development/python-modules/lockfile/default.nix +++ b/pkgs/development/python-modules/lockfile/default.nix @@ -4,7 +4,7 @@ fetchPypi, setuptools, pbr, - nose, + pytestCheckHook, }: buildPythonPackage rec { @@ -17,18 +17,14 @@ buildPythonPackage rec { sha256 = "6aed02de03cba24efabcd600b30540140634fc06cfa603822d508d5361e9f799"; }; + patches = [ ./fix-tests.patch ]; + build-system = [ pbr setuptools ]; - nativeCheckInputs = [ nose ]; - - checkPhase = '' - runHook preCheck - nosetests - runHook postcheck - ''; + nativeCheckInputs = [ pytestCheckHook ]; meta = with lib; { homepage = "https://launchpad.net/pylockfile"; diff --git a/pkgs/development/python-modules/lockfile/fix-tests.patch b/pkgs/development/python-modules/lockfile/fix-tests.patch new file mode 100644 index 0000000000000..882a7dc2af718 --- /dev/null +++ b/pkgs/development/python-modules/lockfile/fix-tests.patch @@ -0,0 +1,28 @@ +diff --git a/test/compliancetest.py b/test/compliancetest.py +index bf4e59c..f55e258 100644 +--- a/test/compliancetest.py ++++ b/test/compliancetest.py +@@ -6,18 +6,19 @@ import lockfile + + + class ComplianceTest(object): +- def __init__(self): +- self.saved_class = lockfile.LockFile ++ @classmethod ++ def setup_class(cls): ++ cls.saved_class = lockfile.LockFile + + def _testfile(self): + """Return platform-appropriate file. Helper for tests.""" + import tempfile + return os.path.join(tempfile.gettempdir(), 'trash-%s' % os.getpid()) + +- def setup(self): ++ def setup_method(self): + lockfile.LockFile = self.class_to_test + +- def teardown(self): ++ def teardown_method(self): + try: + tf = self._testfile() + if os.path.isdir(tf): From 16460dea9802e66b96288df4f0e33e6e4b8382e5 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Wed, 7 Aug 2024 14:36:04 -0400 Subject: [PATCH 2/2] python312Packages.lockfile: modernize --- pkgs/development/python-modules/lockfile/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/lockfile/default.nix b/pkgs/development/python-modules/lockfile/default.nix index e941da384efa3..04e4bc881bfc4 100644 --- a/pkgs/development/python-modules/lockfile/default.nix +++ b/pkgs/development/python-modules/lockfile/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { src = fetchPypi { inherit pname version; - sha256 = "6aed02de03cba24efabcd600b30540140634fc06cfa603822d508d5361e9f799"; + hash = "sha256-au0C3gPLok76vNYAswVAFAY0/AbPpgOCLVCNU2Hp95k="; }; patches = [ ./fix-tests.patch ]; @@ -26,9 +26,9 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook ]; - meta = with lib; { + meta = { homepage = "https://launchpad.net/pylockfile"; description = "Platform-independent advisory file locking capability for Python applications"; - license = licenses.asl20; + license = lib.licenses.asl20; }; }