!6 [sync] PR-5: 去除依赖python-nose
From: @openeuler-sync-bot Reviewed-by: @shinwell_hu Signed-off-by: @shinwell_hu
This commit is contained in:
commit
43789ad460
83
convert-to-unittest.patch
Normal file
83
convert-to-unittest.patch
Normal file
@ -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
|
||||||
@ -1,13 +1,14 @@
|
|||||||
%global _empty_manifest_terminate_build 0
|
%global _empty_manifest_terminate_build 0
|
||||||
Name: python-lockfile
|
Name: python-lockfile
|
||||||
Version: 0.12.2
|
Version: 0.12.2
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Platform-independent file locking module
|
Summary: Platform-independent file locking module
|
||||||
License: MIT License
|
License: MIT License
|
||||||
URL: http://launchpad.net/pylockfile
|
URL: http://launchpad.net/pylockfile
|
||||||
Source0: https://files.pythonhosted.org/packages/17/47/72cb04a58a35ec495f96984dddb48232b551aafb95bde614605b754fe6f7/lockfile-0.12.2.tar.gz
|
Source0: https://files.pythonhosted.org/packages/17/47/72cb04a58a35ec495f96984dddb48232b551aafb95bde614605b754fe6f7/lockfile-0.12.2.tar.gz
|
||||||
|
Patch0000: convert-to-unittest.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python3-pbr python3-nose
|
BuildRequires: python3-pbr python3-pytest
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The lockfile module exports a FileLock class which provides a simple API for
|
The lockfile module exports a FileLock class which provides a simple API for
|
||||||
@ -38,6 +39,7 @@ Development documents and examples for lockfile
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n lockfile-%{version} -p1
|
%autosetup -n lockfile-%{version} -p1
|
||||||
|
cp -r lockfile test/
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%py3_build
|
%py3_build
|
||||||
@ -71,7 +73,7 @@ mv %{buildroot}/filelist.lst .
|
|||||||
mv %{buildroot}/doclist.lst .
|
mv %{buildroot}/doclist.lst .
|
||||||
|
|
||||||
%check
|
%check
|
||||||
PYTHONPATH=./ nosetests-3
|
/usr/bin/pytest
|
||||||
|
|
||||||
%files -n python3-lockfile -f filelist.lst
|
%files -n python3-lockfile -f filelist.lst
|
||||||
%dir %{python3_sitelib}/*
|
%dir %{python3_sitelib}/*
|
||||||
@ -80,5 +82,8 @@ PYTHONPATH=./ nosetests-3
|
|||||||
%{_pkgdocdir}
|
%{_pkgdocdir}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat May 7 2022 caodongxia <caodongxia@h-partners.com> - 0.12.2-2
|
||||||
|
- Remove test dependency on python-nose during build
|
||||||
|
|
||||||
* Wed Aug 25 2021 Python_Bot <Python_Bot@openeuler.org>
|
* Wed Aug 25 2021 Python_Bot <Python_Bot@openeuler.org>
|
||||||
- Package Spec generated
|
- Package Spec generated
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user