Example #1
0
    def test_method_unittest(self):
        class TC(unittest.TestCase):
            def test(self):
                pass

        eq_(nice_test_address(TC('test')),
            'nosenicedots/tests/test_units.py:TC.test')

        case = nose.case.Test(TC('test'))
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:TC.test')
Example #2
0
    def test_function(self):
        def func():
            pass

        case = nose.case.FunctionTestCase(func)
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:func')
Example #3
0
 def test_catastropic_failure(self):
     try:
         raise RuntimeError("really big error")
     except:
         exc = sys.exc_info()
     case = Failure(exc[0], exc[1], exc[2], address=None)
     eq_(nice_test_address(case),
         '??')
Example #4
0
    def test_method_raw(self):
        class TC(object):
            def test(self):
                pass

        case = nose.case.MethodTestCase(unbound_method(TC, TC.test))
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:TC.test')
Example #5
0
 def test_syntax_error(self):
     try:
         raise RuntimeError(
                 "more realistically this would be a SyntaxError")
     except:
         exc = sys.exc_info()
     case = Failure(exc[0], exc[1], tb=exc[2],
                    address=('some_file.py', None, None))
     eq_(nice_test_address(case), 'some_file.py')
Example #6
0
    def test_generator(self):
        def fn(x):
            pass
        def gen():
            yield fn, (1,)

        case = nose.case.FunctionTestCase(gen)
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:gen')
Example #7
0
    def test_method_gen(self):
        def fn(x):
            pass
        class TC(object):
            def test_gen(self):
                yield fn, (1,)

        case = nose.case.MethodTestCase(unbound_method(TC, TC.test_gen))
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:TC.test_gen')
Example #8
0
    def test_context_suite(self):
        class module:
            def setup(self):
                pass
            def teardown(self):
                pass

        context = module()
        suite = nose.suite.ContextSuite([], context=context)
        def setup():
            pass
        def func():
            pass

        eq_(nice_test_address(suite),
            'nosenicedots/tests/test_units.py:module')