diff --git a/convert-to-unittest.patch b/convert-to-unittest.patch new file mode 100644 index 0000000..700ba15 --- /dev/null +++ b/convert-to-unittest.patch @@ -0,0 +1,83 @@ +diff -ur lockfile-0.12.2-orig/test/compliancetest.py lockfile-0.12.2/test/compliancetest.py +--- lockfile-0.12.2-orig/test/compliancetest.py 2015-11-26 01:29:13.000000000 +0700 ++++ lockfile-0.12.2/test/compliancetest.py 2020-08-16 07:58:15.176973406 +0700 +@@ -1,23 +1,22 @@ + import os + import threading + import shutil ++import unittest + + import lockfile + + + class ComplianceTest(object): +- def __init__(self): +- self.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): +- lockfile.LockFile = self.class_to_test ++ def setUp(self): ++ self.saved_class = lockfile.LockFile ++ lockfile.LockFile = getattr(self, 'class_to_test', None) + +- def teardown(self): ++ def tearDown(self): + try: + tf = self._testfile() + if os.path.isdir(tf): +diff -ur lockfile-0.12.2-orig/test/test_lockfile.py lockfile-0.12.2/test/test_lockfile.py +--- lockfile-0.12.2-orig/test/test_lockfile.py 2015-11-26 01:29:13.000000000 +0700 ++++ lockfile-0.12.2/test/test_lockfile.py 2020-08-16 07:58:49.461371422 +0700 +@@ -1,3 +1,5 @@ ++import unittest ++ + import lockfile.linklockfile + import lockfile.mkdirlockfile + import lockfile.pidlockfile +@@ -6,28 +8,28 @@ + from compliancetest import ComplianceTest + + +-class TestLinkLockFile(ComplianceTest): ++class TestLinkLockFile(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.linklockfile.LinkLockFile + + +-class TestSymlinkLockFile(ComplianceTest): ++class TestSymlinkLockFile(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.symlinklockfile.SymlinkLockFile + + +-class TestMkdirLockFile(ComplianceTest): ++class TestMkdirLockFile(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.mkdirlockfile.MkdirLockFile + + +-class TestPIDLockFile(ComplianceTest): ++class TestPIDLockFile(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.pidlockfile.PIDLockFile + + + # Check backwards compatibility +-class TestLinkFileLock(ComplianceTest): ++class TestLinkFileLock(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.LinkFileLock + + +-class TestMkdirFileLock(ComplianceTest): ++class TestMkdirFileLock(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.MkdirFileLock + + try: +@@ -37,5 +39,5 @@ + else: + import lockfile.sqlitelockfile + +- class TestSQLiteLockFile(ComplianceTest): ++ class TestSQLiteLockFile(ComplianceTest, unittest.TestCase): + class_to_test = lockfile.sqlitelockfile.SQLiteLockFile diff --git a/python-lockfile.changes b/python-lockfile.changes index a0b1bdc..63ead04 100644 --- a/python-lockfile.changes +++ b/python-lockfile.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Aug 16 15:16:13 UTC 2020 - John Vandenberg + +- Add convert-to-unittest.patch to switch from nose to pytest +- Add %fdupes + ------------------------------------------------------------------- Mon Feb 25 21:54:28 UTC 2019 - John Vandenberg diff --git a/python-lockfile.spec b/python-lockfile.spec index 68f1c0e..1fcb98f 100644 --- a/python-lockfile.spec +++ b/python-lockfile.spec @@ -1,7 +1,7 @@ # # spec file for package python-lockfile # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,9 +26,11 @@ Group: Development/Languages/Python URL: https://github.com/openstack/pylockfile Source: https://files.pythonhosted.org/packages/source/l/lockfile/lockfile-%{version}.tar.gz Patch0: %{name}-empty_ident.patch -BuildRequires: %{python_module nose} +Patch1: convert-to-unittest.patch BuildRequires: %{python_module pbr} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch %python_subpackages @@ -47,16 +49,18 @@ production-quality code. %setup -q -n lockfile-%{version} # current thread has ident = None, which causes a TypeError # http://code.google.com/p/pylockfile/issues/detail?id=8 -%patch0 -p1 -b .empty_ident +%patch0 -p1 +%patch1 -p1 %build %python_build %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_exec -m nose +%pytest %files %{python_files} %license LICENSE