Replace nose with unittest and pytest

* Replace raise nose.SkipTest with raise unittest.SkipTest
* Replace nose.tools.assert_equal(a, b) with assert a == b
* Replace nose.tools.raises with pytest.raises
* Convert @raises decorator to pytest.raises() but just for relevant
  lines.
* Remove nose dependency

I left the nose_compat pytest plugin in place. It can be removed in
another request in case it is no longer used.

https://pagure.io/freeipa/issue/7301

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Christian Heimes
2017-12-06 17:01:57 +01:00
parent 6a8c84718d
commit d7426ccbe7
31 changed files with 385 additions and 328 deletions

View File

@@ -24,8 +24,7 @@ Test the `ipaserver/plugins/permission.py` module.
from __future__ import print_function
import os
import nose
import unittest
from ipalib import api, errors
from ipatests.test_xmlrpc import objectclasses
@@ -3448,7 +3447,7 @@ class test_managed_permissions(Declarative):
super(test_managed_permissions, cls).setup_class()
if not have_ldap2:
raise nose.SkipTest('server plugin not available')
raise unittest.SkipTest('server plugin not available')
def add_managed_permission(self):
"""Add a managed permission and the corresponding ACI"""