'Return the collection node of a file.
:param config: :py:class:`_pytest.config.Config` instance, see
:py:meth:`parseconfig` and :py:meth:`parseconfigure` to
create the configuration.
:param arg: A :py:class:`py.path.local` instance of the file.'

def getnode(self, config, arg):

    session = Session(config)
    assert ('::' not in str(arg))
    p = py.path.local(arg)
    config.hook.pytest_sessionstart(session=session)
    res = session.perform_collect([str(p)], genitems=False)[0]
    config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
    return res
