Commits

holger krekel committed 87f0960

rename config.opts to config.option

  • Participants
  • Parent commits 2a7cba4

Comments (0)

Files changed (3)

tests/test_config.py

 class TestGlobalOptions:
     def test_notest(self, newconfig):
         config = newconfig([], "")
-        assert not config.opts.notest
+        assert not config.option.notest
         config = newconfig(["--notest"], "")
-        assert config.opts.notest
+        assert config.option.notest
 
     def test_verbosity(self, newconfig):
         config = newconfig([], "")
-        assert config.opts.verbosity == 0
+        assert config.option.verbosity == 0
         config = newconfig(["-v"], "")
-        assert config.opts.verbosity == 1
+        assert config.option.verbosity == 1
         config = newconfig(["-vv"], "")
-        assert config.opts.verbosity == 2
+        assert config.option.verbosity == 2
 
     def test_substitution_jenkins_default(self, tmpdir, monkeypatch, newconfig):
         monkeypatch.setenv("HUDSON_URL", "xyz")
         self.tw.sep("_", "summary")
 
     def info(self, msg):
-        if self.session.config.opts.verbosity >= 2:
+        if self.session.config.option.verbosity >= 2:
             self.logline(msg)
 
     def using(self, msg):
-        if self.session.config.opts.verbosity >= 1:
+        if self.session.config.option.verbosity >= 1:
             self.logline("using %s" %(msg,), bold=True)
 
 
         self.tw.line("%s" % msg, **opts)
 
     def verbosity0(self, msg, **opts):
-        if self.session.config.opts.verbosity >= 0:
+        if self.session.config.option.verbosity >= 0:
             self.tw.line("%s" % msg, **opts)
 
     def verbosity1(self, msg, **opts):
-        if self.session.config.opts.verbosity >= 1:
+        if self.session.config.option.verbosity >= 1:
             self.tw.line("%s" % msg, **opts)
 
     def verbosity2(self, msg, **opts):
-        if self.session.config.opts.verbosity >= 2:
+        if self.session.config.option.verbosity >= 2:
             self.tw.line("%s" % msg, **opts)
 
     #def log(self, msg):
                     "tox version is %s, required is at least %s" %(
                        toxversion, minversion))
                 raise SystemExit(1)
-        if self.config.opts.showconfig:
+        if self.config.option.showconfig:
             self.showconfig()
         else:
             return self.subcommand_test()
                 return False
 
     def sdist(self):
-        if not self.config.opts.sdistonly and self.config.sdistsrc:
+        if not self.config.option.sdistonly and self.config.sdistsrc:
             self.report.info("using sdistfile %r, skipping 'sdist' activity " %
                 str(self.config.sdistsrc))
             sdist_path = self.config.sdistsrc
         sdist_path = self.sdist()
         if not sdist_path:
             return 2
-        if self.config.opts.sdistonly:
+        if self.config.option.sdistonly:
             return
         for venv in self.venvlist:
             if self.setupenv(venv):
         return retcode
 
     def runtestenv(self, venv, sdist_path, redirect=False):
-        if not self.config.opts.notest:
+        if not self.config.option.notest:
             if self.venvstatus[venv.path]:
                 return
             if venv.test(redirect=redirect):
 
     def showconfig(self):
         self.info_versions()
-        self.report.keyvalue("config-file:", self.config.opts.configfile)
+        self.report.keyvalue("config-file:", self.config.option.configfile)
         self.report.keyvalue("toxinipath: ", self.config.toxinipath)
         self.report.keyvalue("toxinidir:  ", self.config.toxinidir)
         self.report.keyvalue("toxworkdir: ", self.config.toxworkdir)
     parser = prepare_parse(pkg)
     opts = parser.parse_args(args)
     config = Config()
-    config.opts = opts
+    config.option = opts
     parseini(config)
     return config
 
 
 class parseini:
     def __init__(self, config):
-        config.opts.configfile = py.path.local(config.opts.configfile)
-        config.toxinipath = config.opts.configfile
+        config.option.configfile = py.path.local(config.option.configfile)
+        config.toxinipath = config.option.configfile
         config.toxinidir = toxinidir = config.toxinipath.dirpath()
 
         if not config.toxinipath.check():
             name, url = map(lambda x: x.strip(), line.split("=", 1))
             config.indexserver[name] = IndexServerConfig(name, url)
 
-        if config.opts.indexurl:
-            for urldef in config.opts.indexurl:
+        if config.option.indexurl:
+            for urldef in config.option.indexurl:
                 m = re.match(r"(\w+)=(\S+)", urldef)
                 if m is None:
                     url = urldef
         vc.envlogdir = reader.getpath(section, "envlogdir", "{envdir}/log")
         reader.addsubstitions(envlogdir=vc.envlogdir, envtmpdir=vc.envtmpdir)
         vc.changedir = reader.getpath(section, "changedir", "{toxinidir}")
-        if config.opts.recreate:
+        if config.option.recreate:
             vc.recreate = True
         else:
             vc.recreate = reader.getbool(section, "recreate", False)
-        args = config.opts.args
+        args = config.option.args
         if args:
             if vc.args_are_paths:
                 args = []
-                for arg in config.opts.args:
+                for arg in config.option.args:
                     origpath = config.invocationcwd.join(arg, abs=True)
                     if origpath.check():
                         arg = vc.changedir.bestrelpath(origpath)
         return vc
 
     def _getenvlist(self, reader, toxsection):
-        env = self.config.opts.env
+        env = self.config.option.env
         if not env:
             env = os.environ.get("TOXENV", None)
             if not env: