]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/mgr/dashboard: use setUpClass for initializeing class 40657/head
authorKefu Chai <kchai@redhat.com>
Fri, 16 Oct 2020 17:10:24 +0000 (01:10 +0800)
committerBrad Hubbard <bhubbard@redhat.com>
Thu, 13 May 2021 03:14:42 +0000 (13:14 +1000)
commitb0db709ed2f4d237062896d61544564170314c6a
tree3f95d0617dd1a257fab077d8ce71df8be9c47109
parentc880cef9b28f264db707cb354889875bb95c8f35
pybind/mgr/dashboard: use setUpClass for initializeing class

instead of relying on __init__(), use setUpClass() to initialize class
for testing. it turns out in pytest > 4, __init__() is called for the
test class but the attributes of the instantiated class is in turn overriden.

so we have to use setUpClass to do this job.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 71979e9b46e21dc3d3cfc6f06f4a84c9b4c7ce78)

 Conflicts:
src/pybind/mgr/dashboard/tests/test_api_auditing.py:
          Differences in import lines
src/pybind/mgr/dashboard/tests/test_tools.py:
          Differences in import lines
src/pybind/mgr/dashboard/tests/__init__.py
src/pybind/mgr/dashboard/tests/test_api_auditing.py
src/pybind/mgr/dashboard/tests/test_settings.py
src/pybind/mgr/dashboard/tests/test_tools.py