pulp/pulp-smash

Drop unittest from non-test code

Ichimonji10 opened this issue · 1 comments

Let's search through all non-test code (e.g. pulp_smash.utils) and drop references to unittest. We want to let third parties run functional tests using any test runner of their choice, and referencing unittest harms our value proposition.

In cases where we currently raise a SkipTest exception, we could try raising a custom exception instead.

As of commit 1497319:

$ git grep --max-depth 2 unittest pulp_smash
pulp_smash/pulp2/utils.py:import unittest
pulp_smash/pulp2/utils.py:class BaseAPICrudTestCase(unittest.TestCase):
pulp_smash/pulp2/utils.py:            'Avoid using BaseAPICrudTestCase. It is coupled to the unittest '
pulp_smash/pulp2/utils.py:            raise unittest.SkipTest('Abstract base class.')
pulp_smash/pulp2/utils.py:class BaseAPITestCase(unittest.TestCase):
pulp_smash/pulp2/utils.py:        https://docs.python.org/3.6/library/unittest.html#unittest.TestCase.addCleanup
pulp_smash/pulp2/utils.py:            'Avoid using BaseAPITestCase. It is coupled to the unittest test '
pulp_smash/pulp2/utils.py:            'logic. If you are using unittest, delete orphans only as needed, '
pulp_smash/selectors.py:    >>> import unittest
pulp_smash/selectors.py:    >>> class MyTestCase(unittest.TestCase):
pulp_smash/selectors.py:    ...     @selectors.require('2.7', unittest.SkipTest)
pulp_smash/selectors.py:    >>> from unittest import SkipTest
pulp_smash/selectors.py:    >>> unittest_require = partial(require, exc=SkipTest)
pulp_smash/selectors.py:            """Wrap a (unittest test) method."""
pulp_smash/selectors.py:    >>> import unittest
pulp_smash/selectors.py:    >>> class MyTestCase(unittest.TestCase):
pulp_smash/selectors.py:    ...     @skip_if(bool, 'my_var', False, unittest.SkipTest)
pulp_smash/selectors.py:    ...     @skip_if(bool, 'my_var', False, unittest.SkipTest)
pulp_smash/selectors.py:    >>> from unittest import SkipTest
pulp_smash/selectors.py:    >>> unittest_skip_if = partial(skip_if, exc=SkipTest)
pulp_smash/selectors.py:            """Wrap a (unittest test) method."""
pulp_smash/tests/__init__.py:unittest test runner from the standard library does just that. As of this
pulp_smash/tests/__init__.py:passed when calling ``python -m unittest``. A more efficacious solution is to
pulp_smash/tests/__init__.py:.. _setUpModule: https://docs.python.org/3/library/unittest.html#setupmodule-and-teardownmodule