def getmodulecol(self, source, configargs=(), withinit=False):
if isinstance(source, Path):<EOL><INDENT>path = self.tmpdir.join(str(source))<EOL>assert not withinit, "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>kw = {self.request.function.__name__: Source(source).strip()}<EOL>path = self.makepyfile(**kw)<EOL><DEDENT>if withinit:<EOL><INDENT>self.makepyfile(__init__="<STR_LIT:#>")<EOL><DEDENT>self.config = config = self.parseconfigure(path, *configargs)<EOL>return self.getnode(config, path)<EOL>
Return the module collection node for ``source``.

        This writes ``source`` to a file using :py:meth:`makepyfile` and then
        runs the pytest collection on it, returning the collection node for the
        test module.

        :param source: the source code of the module to collect

        :param configargs: any extra arguments to pass to
            :py:meth:`parseconfigure`

        :param withinit: whether to also write an ``__init__.py`` file to the
            same directory to ensure it is a package