summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMauricio Villegas <mauricio_ville@yahoo.com>2020-10-30 13:59:45 +0100
committerGitHub <noreply@github.com>2020-10-30 12:59:45 +0000
commit470ad94cd10d058fcf74e4e3487a22ec27fbf106 (patch)
tree7c9ffc0b373dd22a9abf03b9a900c144ed85fabd /src
parentb5ff4dc6b576e83818bef74d5f66d4e01913a858 (diff)
downloadtox-git-470ad94cd10d058fcf74e4e3487a22ec27fbf106.tar.gz
Parse [tox:testenv] sections in setup.cfg (#1724)
Diffstat (limited to 'src')
-rw-r--r--src/tox/config/__init__.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py
index 6e80d406..03f11d8b 100644
--- a/src/tox/config/__init__.py
+++ b/src/tox/config/__init__.py
@@ -1246,15 +1246,16 @@ class ParseIni(object):
results = {}
cur_self = self
- def run(name, section, subs, config):
+ def run(name, section, subs, config, prefix):
try:
- results[name] = cur_self.make_envconfig(name, section, subs, config)
+ results[name] = cur_self.make_envconfig(name, section, subs, config, prefix=prefix)
except Exception as exception:
failures[name] = (exception, traceback.format_exc())
order = []
+ prefix = "tox:" if ini_path.basename == "setup.cfg" else ""
for name in all_envs:
- section = "{}{}".format(testenvprefix, name)
+ section = "{}{}".format(prefix + testenvprefix, name)
factors = set(name.split("-"))
if (
section in self._cfg
@@ -1264,7 +1265,7 @@ class ParseIni(object):
)
):
order.append(name)
- thread = Thread(target=run, args=(name, section, reader._subs, config))
+ thread = Thread(target=run, args=(name, section, reader._subs, config, prefix))
thread.daemon = True
thread.start()
to_do.append(thread)
@@ -1377,9 +1378,14 @@ class ParseIni(object):
factors.update(*mapcat(_split_factor_expr_all, exprs))
return factors
- def make_envconfig(self, name, section, subs, config, replace=True):
+ def make_envconfig(self, name, section, subs, config, replace=True, prefix=""):
factors = set(name.split("-"))
- reader = SectionReader(section, self._cfg, fallbacksections=["testenv"], factors=factors)
+ reader = SectionReader(
+ section,
+ self._cfg,
+ fallbacksections=[prefix + "testenv"],
+ factors=factors,
+ )
tc = TestenvConfig(name, config, factors, reader)
reader.addsubstitutions(
envname=name,