]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/pybind/ceph_daemon: Switch to bare unittest
authorSteve Kowalik <steven@wedontsleep.org>
Mon, 4 Apr 2022 01:55:04 +0000 (11:55 +1000)
committerTim Serong <tserong@suse.com>
Fri, 13 May 2022 03:53:24 +0000 (13:53 +1000)
nose has been unmaintained for a long time, and to work on
removing it as a dependency, re-work test_ceph_daemon to use
bare unittest.

Signed-off-by: Steve Kowalik <steven@wedontsleep.org>
(cherry picked from commit 34d8fc182eb10eb5003d162bcc4ba6bc91e399b3)

src/test/pybind/CMakeLists.txt
src/test/pybind/test_ceph_daemon.py

index 2f4051abc926d6585d8fa1e3ccb36c462a7b4a35..b2f0552a4ee1eb1f4fcdcad13de3b0d39a7fd11a 100644 (file)
@@ -1,4 +1,4 @@
 add_ceph_test(test_ceph_daemon.py
-  ${Python3_EXECUTABLE} -m nose ${CMAKE_CURRENT_SOURCE_DIR}/test_ceph_daemon.py)
+  ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_ceph_daemon.py)
 add_ceph_test(test_ceph_argparse.py
   ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_ceph_argparse.py)
index f3a229a8ceec461fb9f4bb848133d2744ee9b853..df8d4c0b09b91548069e7f0efdfcf53d5889a4c1 100755 (executable)
@@ -11,7 +11,7 @@ License version 2, as published by the Free Software
 Foundation.  See file COPYING.
 """
 
-from unittest import TestCase
+import unittest
 
 from ceph_daemon import DaemonWatcher
 
@@ -21,7 +21,7 @@ except ImportError:
     from io import StringIO
 
 
-class TestDaemonWatcher(TestCase):
+class TestDaemonWatcher(unittest.TestCase):
     def test_format(self):
         dw = DaemonWatcher(None)
 
@@ -39,10 +39,14 @@ class TestDaemonWatcher(TestCase):
     def test_supports_color(self):
         dw = DaemonWatcher(None)
         # Can't count on having a tty available during tests, so only test the false case
-        self.assertEqual(dw.supports_color(StringIO()), False)
+        self.assertFalse(dw.supports_color(StringIO()))
+
+
+if __name__ == '__main__':
+    unittest.main()
+
 
 # Local Variables:
 # compile-command: "cd ../../..;
-#  PYTHONPATH=src/pybind nosetests --stop \
-#  src/test/pybind/test_ceph_daemon.py"
+#  PYTHONPATH=src/pybind python3 src/test/pybind/test_ceph_daemon.py"
 # End: