コード例 #1
0
 def parse(self, args):
     """ parse cmdline arguments into this config object. 
         Note that this can only be called once per testing process. 
     """
     assert not hasattr(self, 'args'), (
         "can only parse cmdline args at most once per Config object")
     self._preparse(args)
     self._parser.hints.extend(self.pluginmanager._hints)
     args = self._parser.parse_setoption(args, self.option)
     if not args:
         args.append(py.std.os.getcwd())
     self.topdir = gettopdir(args)
     self._rootcol = RootCollector(config=self)
     self._setargs(args)
コード例 #2
0
 def __setstate__(self, repr):
     # we have to set py.test.config because loading
     # of conftest files may use it (deprecated)
     # mainly by py.test.config.addoptions()
     global config_per_process
     py.test.config = config_per_process = self
     args, cmdlineopts = repr
     cmdlineopts = CmdOptions(**cmdlineopts)
     # next line will registers default plugins
     self.__init__(topdir=py.path.local(), option=cmdlineopts)
     self._rootcol = RootCollector(config=self)
     args = [str(self.topdir.join(x)) for x in args]
     self._preparse(args)
     self._setargs(args)