{"action":"opened","issue":{"url":"https://api.github.com/repos/pytest-dev/pytest/issues/948","labels_url":"https://api.github.com/repos/pytest-dev/pytest/issues/948/labels{/name}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/issues/948/comments","events_url":"https://api.github.com/repos/pytest-dev/pytest/issues/948/events","html_url":"https://github.com/pytest-dev/pytest/issues/948","id":101880629,"number":948,"title":"session scope fixtures can't run tests which does not start with test* or setup*","user":{"login":"mrniranjan","id":1172008,"avatar_url":"https://avatars.githubusercontent.com/u/1172008?v=3","gravatar_id":"","url":"https://api.github.com/users/mrniranjan","html_url":"https://github.com/mrniranjan","followers_url":"https://api.github.com/users/mrniranjan/followers","following_url":"https://api.github.com/users/mrniranjan/following{/other_user}","gists_url":"https://api.github.com/users/mrniranjan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrniranjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrniranjan/subscriptions","organizations_url":"https://api.github.com/users/mrniranjan/orgs","repos_url":"https://api.github.com/users/mrniranjan/repos","events_url":"https://api.github.com/users/mrniranjan/events{/privacy}","received_events_url":"https://api.github.com/users/mrniranjan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-19T12:26:12Z","updated_at":"2015-08-19T12:26:12Z","closed_at":null,"body":"I am following the  link: https://pytest.org/latest/example/special.html  to understand how session scoped fixtures work if we have to call a particular test function like 'callme' as specified in the example\r\n\r\nBut the example doesn't work with pytest version 2.7, (works as expected with pytest 2.3).\r\n\r\nBelow is the conftest.py \r\n\r\n```\r\nimport pytest\r\n\r\n@pytest.fixture(scope=\"session\", autouse=True)\r\ndef callattr_ahead_of_alltests(request):\r\n    print (\"callattr_ahead_of_alltests called\")\r\n    seen = set([None])\r\n    session = request.node\r\n    for item in session.items:\r\n        cls = item.getparent(pytest.Class)\r\n        if cls not in seen:\r\n            if hasattr(cls.obj, \"callme\"):\r\n               cls.obj.callme()\r\n            seen.add(cls)\r\n```\r\nBelow is the test_module.py\r\n```\r\nclass TestHello:\r\n    @classmethod\r\n    def callme(cls):\r\n        print (\"callme called!\")\r\n\r\n    def test_method1(self):\r\n        print (\"test_method1 called\")\r\n\r\n    def test_method2(self):\r\n        print (\"test_method1 called\")\r\n\r\nclass TestOther:\r\n    @classmethod\r\n    def callme(cls):\r\n        print (\"callme other called\")\r\n    def test_other(self):\r\n        print (\"test other\")\r\n\r\n# works with unittest as well ...\r\nimport unittest\r\n\r\nclass SomeTest(unittest.TestCase):\r\n    @classmethod\r\n    def callme(self):\r\n        print (\"SomeTest callme called\")\r\n\r\n    def test_unit1(self):\r\n        print (\"test_unit1 method called\")``\r\n```\r\nOutput when run:\r\n```\r\n$ py.test test_module.py -s\r\n========================== test session starts ========================== \r\nplatform linux2 -- Python 2.7.5 -- py-1.4.27 -- pytest-2.7.0\r\nrootdir: /root, inifile: pytest.ini\r\nplugins: multihost\r\ncollected 1 items \r\n\r\ntest_module.py callattr_ahead_of_alltests called\r\nSomeTest callme called\r\ntest_unit1 method called\r\n.\r\n```\r\nAs you can see in the above output, callme function is called only if unittest.testcase module is loaded otherwise this function is not called. \r\n\r\nWhere as with py.test 2.3 it works as expected. \r\n```\r\nplatform linux2 -- Python 2.7.5 -- pytest-2.3.5\r\ncollected 4 items \r\n\r\ntest_module.py callattr_ahead_of_alltests called\r\ncallme called!\r\ncallme other called\r\nSomeTest callme called\r\ntest_method1 called\r\n.test_method1 called\r\n.test other\r\n.test_unit1 method called\r\n.\r\n```\r\n\r\nAdditional Details:\r\nVersion of python: python-2.7.5-16.el7.x86_64 (In both working and non working systems)\r\nRHEL7.1 (x86_64)\r\n"}}