Module Import alias FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args defaults body ImportFrom alias Assign NameStore ListLoad ClassDef bases body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Num decorator_list Call AttributeLoad NameLoad attr keyword NameLoad decorator_list Expr Call NameLoad Call NameLoad Str Assert UnaryOpNot NameLoad decorator_list FunctionDef arguments args defaults body ImportFrom alias ClassDef bases body Assign NameStore Num decorator_list Expr Call NameLoad Call NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Num keyword Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Assert UnaryOpNot Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Assert UnaryOpNot NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Assert UnaryOpNot Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Assert UnaryOpNot NameLoad decorator_list
N/A N/A pytest setup_module N/A N/A mod N/A N/A N/A N/A mod nose N/A N/A pytest importorskip nose N/A test_nose_setup N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        l = []
        from nose.tools import with_setup

        @with_setup(lambda: l.append(1), lambda: l.append(2))
        def test_hello():
            assert l == [1]

        def test_world():
            assert l == [1,2]

        test_hello.setup = lambda: l.append(1)
        test_hello.teardown = lambda: l.append(2)
     N/A result N/A N/A testdir runpytest p -p nose N/A N/A N/A result assert_outcomes passed 2 N/A test_setup_func_with_setup_decorator N/A N/A N/A N/A _pytest.nose call_optional N/A l N/A A N/A N/A f N/A N/A self N/A N/A N/A N/A N/A l append 1 N/A N/A N/A pytest fixture autouse True N/A N/A N/A call_optional N/A A f N/A N/A l N/A test_setup_func_not_callable N/A N/A N/A N/A _pytest.nose call_optional A N/A N/A N/A f 1 N/A N/A N/A call_optional N/A A f N/A test_nose_setup_func N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        from nose.tools import with_setup

        l = []

        def my_setup():
            a = 1
            l.append(a)

        def my_teardown():
            b = 2
            l.append(b)

        @with_setup(my_setup, my_teardown)
        def test_hello():
            print (l)
            assert l == [1]

        def test_world():
            print (l)
            assert l == [1,2]

     N/A result N/A N/A testdir runpytest p -p nose N/A N/A N/A result assert_outcomes passed 2 N/A test_nose_setup_func_failure N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        from nose.tools import with_setup

        l = []
        my_setup = lambda x: 1
        my_teardown = lambda x: 2

        @with_setup(my_setup, my_teardown)
        def test_hello():
            print (l)
            assert l == [1]

        def test_world():
            print (l)
            assert l == [1,2]

     N/A result N/A N/A testdir runpytest p -p nose N/A N/A N/A N/A result stdout fnmatch_lines N/A *TypeError: <lambda>()* N/A test_nose_setup_func_failure_2 N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        l = []

        my_setup = 1
        my_teardown = 2

        def test_hello():
            assert l == []

        test_hello.setup = my_setup
        test_hello.teardown = my_teardown
     N/A reprec N/A N/A testdir inline_run N/A N/A N/A reprec assertoutcome passed 1 N/A test_nose_setup_partial N/A N/A testdir N/A N/A N/A N/A N/A pytest importorskip functools N/A p N/A N/A testdir makepyfile 
        from functools import partial

        l = []

        def my_setup(x):
            a = x
            l.append(a)

        def my_teardown(x):
            b = x
            l.append(b)

        my_setup_partial = partial(my_setup, 1)
        my_teardown_partial = partial(my_teardown, 2)

        def test_hello():
            print (l)
            assert l == [1]

        def test_world():
            print (l)
            assert l == [1,2]

        test_hello.setup = my_setup_partial
        test_hello.teardown = my_teardown_partial
     N/A result N/A N/A testdir runpytest p -p nose N/A N/A N/A N/A result stdout fnmatch_lines N/A *2 passed* N/A test_nose_test_generator_fixtures N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        # taken from nose-0.11.1 unit_tests/test_generator_fixtures.py
        from nose.tools import eq_
        called = []

        def outer_setup():
            called.append('outer_setup')

        def outer_teardown():
            called.append('outer_teardown')

        def inner_setup():
            called.append('inner_setup')

        def inner_teardown():
            called.append('inner_teardown')

        def test_gen():
            called[:] = []
            for i in range(0, 5):
                yield check, i

        def check(i):
            expect = ['outer_setup']
            for x in range(0, i):
                expect.append('inner_setup')
                expect.append('inner_teardown')
            expect.append('inner_setup')
            eq_(called, expect)


        test_gen.setup = outer_setup
        test_gen.teardown = outer_teardown
        check.setup = inner_setup
        check.teardown = inner_teardown

        class TestClass(object):
            def setup(self):
                print ("setup called in %s" % self)
                self.called = ['setup']

            def teardown(self):
                print ("teardown called in %s" % self)
                eq_(self.called, ['setup'])
                self.called.append('teardown')

            def test(self):
                print ("test called in %s" % self)
                for i in range(0, 5):
                    yield self.check, i

            def check(self, i):
                print ("check called in %s" % self)
                expect = ['setup']
                #for x in range(0, i):
                #    expect.append('setup')
                #    expect.append('teardown')
                #expect.append('setup')
                eq_(self.called, expect)
     N/A result N/A N/A testdir runpytest p -p nose N/A N/A N/A N/A result stdout fnmatch_lines N/A *10 passed* N/A test_module_level_setup N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        from nose.tools import with_setup
        items = {}

        def setup():
            items[1]=1

        def teardown():
            del items[1]

        def setup2():
            items[2] = 2

        def teardown2():
            del items[2]

        def test_setup_module_setup():
            assert items[1] == 1

        @with_setup(setup2, teardown2)
        def test_local_setup():
            assert items[2] == 2
            assert 1 not in items
     N/A result N/A N/A testdir runpytest -p nose N/A N/A N/A N/A result stdout fnmatch_lines N/A *2 passed* N/A test_nose_style_setup_teardown N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        l = []

        def setup_module():
            l.append(1)

        def teardown_module():
            del l[0]

        def test_hello():
            assert l == [1]

        def test_world():
            assert l == [1]
         N/A result N/A N/A testdir runpytest -p nose N/A N/A N/A N/A result stdout fnmatch_lines N/A *2 passed* N/A test_nose_setup_ordering N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        def setup_module(mod):
            mod.visited = True

        class TestClass:
            def setup(self):
                assert visited
            def test_first(self):
                pass
         N/A result N/A N/A testdir runpytest N/A N/A N/A N/A result stdout fnmatch_lines N/A *1 passed* N/A test_apiwrapper_problem_issue260 N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        import unittest
        class TestCase(unittest.TestCase):
            def setup(self):
                #should not be called in unittest testcases
                assert 0, 'setup'
            def teardown(self):
                #should not be called in unittest testcases
                assert 0, 'teardown'
            def setUp(self):
                print('setup')
            def tearDown(self):
                print('teardown')
            def test_fun(self):
                pass
         N/A result N/A N/A testdir runpytest N/A N/A N/A result assert_outcomes passed 1 N/A test_setup_teardown_linking_issue265 N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        import pytest

        class TestGeneric(object):
            def test_nothing(self):
                """Tests the API of the implementation (for generic and specialized)."""

        @pytest.mark.skipif("True", reason=
                    "Skip tests to check if teardown is skipped as well.")
        class TestSkipTeardown(TestGeneric):

            def setup(self):
                """Sets up my specialized implementation for $COOL_PLATFORM."""
                raise Exception("should not call setup for skipped tests")

            def teardown(self):
                """Undoes the setup."""
                raise Exception("should not call teardown for skipped tests")
         N/A reprec N/A N/A testdir runpytest N/A N/A N/A reprec assert_outcomes passed 1 skipped 1 N/A test_SkipTest_during_collection N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        import nose
        raise nose.SkipTest("during collection")
        def test_failing():
            assert False
         N/A result N/A N/A testdir runpytest p N/A N/A N/A result assert_outcomes skipped 1 N/A test_SkipTest_in_test N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        import nose

        def test_skipping():
            raise nose.SkipTest("in test")
         N/A reprec N/A N/A testdir inline_run N/A N/A N/A reprec assertoutcome skipped 1 N/A test_istest_function_decorator N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        import nose.tools
        @nose.tools.istest
        def not_test_prefix():
            pass
         N/A result N/A N/A testdir runpytest p N/A N/A N/A result assert_outcomes passed 1 N/A test_nottest_function_decorator N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        import nose.tools
        @nose.tools.nottest
        def test_prefix():
            pass
         N/A reprec N/A N/A testdir inline_run N/A N/A N/A N/A reprec getfailedcollections N/A calls N/A N/A reprec getreports pytest_runtest_logreport N/A N/A calls N/A test_istest_class_decorator N/A N/A testdir N/A N/A N/A p N/A N/A testdir makepyfile 
        import nose.tools
        @nose.tools.istest
        class NotTestPrefix:
            def test_method(self):
                pass
         N/A result N/A N/A testdir runpytest p N/A N/A N/A result assert_outcomes passed 1 N/A test_nottest_class_decorator N/A N/A testdir N/A N/A N/A N/A N/A testdir makepyfile 
        import nose.tools
        @nose.tools.nottest
        class TestPrefix:
            def test_method(self):
                pass
         N/A reprec N/A N/A testdir inline_run N/A N/A N/A N/A reprec getfailedcollections N/A calls N/A N/A reprec getreports pytest_runtest_logreport N/A N/A calls N/A