]> git.apps.os.sepia.ceph.com Git - ragweed.git/commitdiff
ragweed: switch to pytest framework 25/head
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 31 Jan 2023 16:56:18 +0000 (11:56 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 31 Jan 2023 16:58:50 +0000 (11:58 -0500)
due to deprecation of nose

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
README.rst
bootstrap
pytest.ini [new file with mode: 0644]
ragweed/framework.py
requirements.txt

index 015d77530a33caabe3e67d075ab8569fcc9add0e..5cb65452684e1ed6d319f392ee45cdc789eac83f 100644 (file)
@@ -14,7 +14,7 @@ Each of these phases can be executed separately.
 
 For more information on the background of the tests visit: https://www.spinics.net/lists/ceph-devel/msg34636.html
 
-The tests use the Nose test framework. To get started, ensure you have
+The tests use the pytest test framework. To get started, ensure you have
 the ``virtualenv`` software installed; e.g. on Debian/Ubuntu::
 
        sudo apt-get install python-virtualenv
@@ -33,7 +33,7 @@ service and two different credentials. A sample configuration file named
 
 Once you have that file copied and edited, you can run the tests with::
 
-       RAGWEED_CONF=ragweed.conf RAGWEED_STAGES=prepare,check ./virtualenv/bin/nosetests -v
+       RAGWEED_CONF=ragweed.conf RAGWEED_STAGES=prepare,check ./virtualenv/bin/pytest -v
 
 The phase(s) of the tests are set via ``RAGWEED_STAGES``. The options for ``RAGWEED_STAGES``  are ``prepare`` and ``check``. ``test`` can be used instead of ``check``.
 
@@ -63,4 +63,4 @@ OR::
 
 Finally run the ragweed tests::
 
-       RAGWEED_CONF=ragweed.conf RAGWEED_STAGES=prepare,check ./virtualenv/bin/nosetests -v
+       RAGWEED_CONF=ragweed.conf RAGWEED_STAGES=prepare,check ./virtualenv/bin/pytest -v
index 68d42f3e3480cf5a4dd81bafe89dce92fce0b64c..2abd2ea4666f60d0a15e15713a6910b5623352c8 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -34,7 +34,7 @@ virtualenv -p python3 --system-site-packages --download virtualenv
 
 # work-around change in pip 1.5
 ./virtualenv/bin/pip install six
-./virtualenv/bin/pip install -I nose
+./virtualenv/bin/pip install -U pytest
 ./virtualenv/bin/pip install setuptools
 
 ./virtualenv/bin/pip install -U -r requirements.txt
diff --git a/pytest.ini b/pytest.ini
new file mode 100644 (file)
index 0000000..48f2cbe
--- /dev/null
@@ -0,0 +1,3 @@
+[pytest]
+python_classes = r_test
+python_files = test*.py
index 3dfb3e403596018402dd7b96a85c30c0e85da540..a02d18ec8c69703545adf5f15ad745f60e359a64 100644 (file)
@@ -15,6 +15,8 @@ import rados
 
 from .reqs import _make_admin_request
 
+import pytest
+
 ragweed_env = None
 suite = None
 
@@ -287,7 +289,7 @@ class RZone:
 
 
 class RTest:
-    def __init__(self):
+    def setup_method(self):
         self._name = self.__class__.__name__
         self.r_buckets = []
         self.init()
@@ -445,6 +447,7 @@ class RagweedEnv:
                 'ceph_conf is missing under the [rados] section in ' + os.environ['RAGWEED_CONF']
                 )
 
+        print('conf=' + str(self.ceph_conf))
         self.rados = rados.Rados(conffile=self.ceph_conf)
         self.rados.connect()
 
@@ -459,3 +462,8 @@ def setup_module():
 
     ragweed_env = RagweedEnv()
     suite = ragweed_env.suite
+
+@pytest.fixture(scope="package", autouse=True)
+def setup_teardown():
+    setup_module()
+    yield
index 178ef67966ca8e5a98545a2621664c745472c90a..b196d563f3cff12fbd6d4c4b0b4471146681ad26 100644 (file)
@@ -1,5 +1,5 @@
 PyYAML
-nose >=1.0.0
+pytest
 boto >=2.6.0, != 2.46.0
 munch >=1.0.0
 gevent >=1.0