diff options
author | Ronald Evers <ronald@ch10.nl> | 2013-10-09 21:37:33 +0200 |
---|---|---|
committer | Ronald Evers <ronald@ch10.nl> | 2013-10-09 21:37:33 +0200 |
commit | 48a2424ff4167198fc484df4c54ca8e0ed59a4a2 (patch) | |
tree | c41242b65fb8be150449dc91b59a557aa7a828fd | |
parent | dbf1cbf4a71e1a034a2567985743422ac9a7a912 (diff) | |
download | tox-48a2424ff4167198fc484df4c54ca8e0ed59a4a2.tar.gz |
substitute substition for substitution
-rw-r--r-- | doc/announce/release-1.4.txt | 2 | ||||
-rw-r--r-- | doc/config.txt | 22 | ||||
-rw-r--r-- | tests/test_config.py | 22 | ||||
-rw-r--r-- | tox/_config.py | 26 |
4 files changed, 36 insertions, 36 deletions
diff --git a/doc/announce/release-1.4.txt b/doc/announce/release-1.4.txt index 243ecec..d0e6644 100644 --- a/doc/announce/release-1.4.txt +++ b/doc/announce/release-1.4.txt @@ -4,7 +4,7 @@ tox 1.4: the virtualenv-based test run automatizer I am happy to announce tox 1.4 which brings: - improvements with configuration file syntax, now allowing re-using - selected settings across config file sections. see http://testrun.org/tox/latest/config.html#substition-for-values-from-other-sections + selected settings across config file sections. see http://testrun.org/tox/latest/config.html#substitution-for-values-from-other-sections - terminal reporting was simplified and streamlined. Now with verbosity==0 (the default), less information will be shown diff --git a/doc/config.txt b/doc/config.txt index 63970f6..8eb8f3a 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -1,7 +1,7 @@ .. be in -*- rst -*- mode! tox configuration specification -================================ +=============================== .. _ConfigParser: http://docs.python.org/library/configparser.html @@ -10,7 +10,7 @@ Below you find the specification, but you might want to skim some :doc:`examples` first and use this page as a reference. Tox global settings ----------------------- +------------------- List of optional global options:: @@ -34,7 +34,7 @@ and will first lookup global tox settings in this section:: envlist setting -+++++++++++++++++++++++++ ++++++++++++++++ Determining the environment list that ``tox`` is to operate on happens in this order: @@ -45,7 +45,7 @@ happens in this order: Virtualenv test environment settings -------------------------------------------- +------------------------------------ Test environments are defined by a:: @@ -236,13 +236,13 @@ Complete list of settings that you can put into ``testenv*`` sections: Substitutions ---------------------- +------------- Any ``key=value`` setting in an ini-file can make use of value substitution through the ``{...}`` string-substitution pattern. Globally available substitutions -+++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++ ``{toxinidir}`` the directory where tox.ini is located @@ -262,7 +262,7 @@ Globally available substitutions they may be accessed by other processes or tox runs. substitutions for virtualenv-related sections -++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++ ``{envname}`` the name of the virtual environment @@ -282,7 +282,7 @@ substitutions for virtualenv-related sections environment variable substitutions -+++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++ If you specify a substitution string like this:: @@ -296,7 +296,7 @@ does not exist. .. _`positional substitution`: substitutions for positional arguments in commands -++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++ .. versionadded:: 1.0 @@ -330,7 +330,7 @@ positional arguments with defaults. This format has been deprecated. Use ``{posargs:DEFAULTS}`` to specify those. -Substition for values from other sections +Substitution for values from other sections +++++++++++++++++++++++++++++++++++++++++++ .. versionadded:: 1.4 @@ -361,7 +361,7 @@ You can put default values in one section and reference them in others to avoid Other Rules and notes -========================= +===================== * ``path`` specifications: if a specified ``path`` is a relative path it will be considered as relative to the ``toxinidir``, the directory diff --git a/tests/test_config.py b/tests/test_config.py index 34c3797..f029ed0 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -156,7 +156,7 @@ class TestIniParser: key={value} """) reader = IniReader(config._cfg, fallbacksections=['mydefault']) - reader.addsubstitions(value="newvalue", value2="newvalue2") + reader.addsubstitutions(value="newvalue", value2="newvalue2") x = reader.getdefault("section", "key2") assert x == "newvalue2" x = reader.getdefault("section", "key3") @@ -172,7 +172,7 @@ class TestIniParser: {item2} """) reader = IniReader(config._cfg) - reader.addsubstitions(item1="not", item2="grr") + reader.addsubstitutions(item1="not", item2="grr") x = reader.getlist("section", "key2") assert x == ['item1', 'grr'] @@ -184,7 +184,7 @@ class TestIniParser: key2={item2} """) reader = IniReader(config._cfg) - reader.addsubstitions(item1="not", item2="grr") + reader.addsubstitutions(item1="not", item2="grr") x = reader.getdict("section", "key2") assert 'key1' in x assert 'key2' in x @@ -235,7 +235,7 @@ class TestIniParser: cmd2 {item2} """) reader = IniReader(config._cfg) - reader.addsubstitions(item1="with space", item2="grr") + reader.addsubstitutions(item1="with space", item2="grr") #py.test.raises(tox.exception.ConfigError, # "reader.getargvlist('section', 'key1')") assert reader.getargvlist('section', 'key1') == [] @@ -251,7 +251,7 @@ class TestIniParser: {item2} """) reader = IniReader(config._cfg) - reader.addsubstitions(item1="with space", item2="grr") + reader.addsubstitutions(item1="with space", item2="grr") #py.test.raises(tox.exception.ConfigError, # "reader.getargvlist('section', 'key1')") assert reader.getargvlist('section', 'key1') == [] @@ -281,7 +281,7 @@ class TestIniParser: """) reader = IniReader(config._cfg) posargs = ['hello', 'world'] - reader.addsubstitions(posargs, item2="value2") + reader.addsubstitutions(posargs, item2="value2") #py.test.raises(tox.exception.ConfigError, # "reader.getargvlist('section', 'key1')") assert reader.getargvlist('section', 'key1') == [] @@ -290,7 +290,7 @@ class TestIniParser: assert argvlist[1] == ["cmd2"] + posargs reader = IniReader(config._cfg) - reader.addsubstitions([], item2="value2") + reader.addsubstitutions([], item2="value2") #py.test.raises(tox.exception.ConfigError, # "reader.getargvlist('section', 'key1')") assert reader.getargvlist('section', 'key1') == [] @@ -309,7 +309,7 @@ class TestIniParser: """) reader = IniReader(config._cfg) posargs = ['hello', 'world'] - reader.addsubstitions(posargs) + reader.addsubstitutions(posargs) argvlist = reader.getargvlist('section', 'key') assert argvlist[0] == ['cmd0'] + posargs @@ -317,7 +317,7 @@ class TestIniParser: assert argvlist[2] == ['cmd2', '-m', "something"] + posargs assert argvlist[3] == ['cmd3', 'something[]else'] - def test_substition_with_multiple_words(self, newconfig): + def test_substitution_with_multiple_words(self, newconfig): inisource = """ [section] key = py.test -n5 --junitxml={envlogdir}/junit-{envname}.xml [] @@ -325,7 +325,7 @@ class TestIniParser: config = newconfig(inisource) reader = IniReader(config._cfg) posargs = ['hello', 'world'] - reader.addsubstitions(posargs, envlogdir='ENV_LOG_DIR', envname='ENV_NAME') + reader.addsubstitutions(posargs, envlogdir='ENV_LOG_DIR', envname='ENV_NAME') expected = ['py.test', '-n5', '--junitxml=ENV_LOG_DIR/junit-ENV_NAME.xml', 'hello', 'world'] assert reader.getargvlist('section', 'key')[0] == expected @@ -347,7 +347,7 @@ class TestIniParser: path1={HELLO} """) reader = IniReader(config._cfg) - reader.addsubstitions(toxinidir=tmpdir, HELLO="mypath") + reader.addsubstitutions(toxinidir=tmpdir, HELLO="mypath") x = reader.getpath("section", "path1", tmpdir) assert x == tmpdir.join("mypath") diff --git a/tox/_config.py b/tox/_config.py index 7939797..1dfef66 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -117,7 +117,7 @@ def prepare_parse(pkgname): "pass-through output from running test commands which is " "instead captured into the json result file.") parser.add_argument("args", nargs="*", - help="additional arguments available to command positional substition") + help="additional arguments available to command positional substitution") return parser class Config(object): @@ -200,8 +200,8 @@ class parseini: raise ValueError("invalid context") - reader.addsubstitions(toxinidir=config.toxinidir, - homedir=config.homedir) + reader.addsubstitutions(toxinidir=config.toxinidir, + homedir=config.homedir) config.toxworkdir = reader.getpath(toxsection, "toxworkdir", "{toxinidir}/.tox") config.minversion = reader.getdefault(toxsection, "minversion", None) @@ -233,13 +233,13 @@ class parseini: for name in config.indexserver: config.indexserver[name] = IndexServerConfig(name, override) - reader.addsubstitions(toxworkdir=config.toxworkdir) + reader.addsubstitutions(toxworkdir=config.toxworkdir) config.distdir = reader.getpath(toxsection, "distdir", "{toxworkdir}/dist") - reader.addsubstitions(distdir=config.distdir) + reader.addsubstitutions(distdir=config.distdir) config.distshare = reader.getpath(toxsection, "distshare", distshare_default) - reader.addsubstitions(distshare=config.distshare) + reader.addsubstitutions(distshare=config.distshare) config.sdistsrc = reader.getpath(toxsection, "sdistsrc", None) config.setupdir = reader.getpath(toxsection, "setupdir", "{toxinidir}") config.logdir = config.toxworkdir.join("log") @@ -270,7 +270,7 @@ class parseini: vc = VenvConfig(envname=name) vc.config = config reader = IniReader(self._cfg, fallbacksections=["testenv"]) - reader.addsubstitions(**subs) + reader.addsubstitutions(**subs) vc.develop = reader.getbool(section, "usedevelop", config.option.develop) vc.envdir = reader.getpath(section, "envdir", "{toxworkdir}/%s" % name) vc.args_are_paths = reader.getbool(section, "args_are_paths", True) @@ -283,12 +283,12 @@ class parseini: bp = sys.executable vc.basepython = reader.getdefault(section, "basepython", bp) vc._basepython_info = config.interpreters.get_info(vc.basepython) - reader.addsubstitions(envdir=vc.envdir, envname=vc.envname, - envbindir=vc.envbindir, envpython=vc.envpython, - envsitepackagesdir=vc.envsitepackagesdir) + reader.addsubstitutions(envdir=vc.envdir, envname=vc.envname, + envbindir=vc.envbindir, envpython=vc.envpython, + envsitepackagesdir=vc.envsitepackagesdir) vc.envtmpdir = reader.getpath(section, "tmpdir", "{envdir}/tmp") vc.envlogdir = reader.getpath(section, "envlogdir", "{envdir}/log") - reader.addsubstitions(envlogdir=vc.envlogdir, envtmpdir=vc.envtmpdir) + reader.addsubstitutions(envlogdir=vc.envlogdir, envtmpdir=vc.envtmpdir) vc.changedir = reader.getpath(section, "changedir", "{toxinidir}") if config.option.recreate: vc.recreate = True @@ -303,7 +303,7 @@ class parseini: if origpath.check(): arg = vc.changedir.bestrelpath(origpath) args.append(arg) - reader.addsubstitions(args) + reader.addsubstitutions(args) vc.setenv = reader.getdict(section, 'setenv') if not vc.setenv: vc.setenv = None @@ -410,7 +410,7 @@ class IniReader: self._subs = {} self._subststack = [] - def addsubstitions(self, _posargs=None, **kw): + def addsubstitutions(self, _posargs=None, **kw): self._subs.update(kw) if _posargs: self._subs['_posargs'] = _posargs |