Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 19 additions & 38 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)

resources:
repositories:
- repository: tox
Expand All @@ -26,47 +25,29 @@ variables:
jobs:
- template: run-tox-env.yml@tox
parameters:
tox_version: ''
jobs:
check:
py: '3.7'
toxenvs:
- fix_lint
- docs
- package_description
windows:
coverage: 'coverage'
toxenvs:
- py37
- py36
- py35
- py34
- py27
linux:
coverage: 'coverage'
toxenvs:
- py38
- py37
- py36
- py35
- py34
- py27
macOs:
coverage: 'coverage'
toxenvs:
- py37
- py27
- template: merge-coverage.yml@tox
parameters:
dependsOn:
- windows
- linux
- macOs
fix_lint: null
docs: null
py37:
image: [linux, windows, macOs]
py27:
image: [linux, windows, macOs]
py36:
image: [linux, windows, macOs]
py35:
image: [linux, windows, macOs]
py34:
image: [linux, windows, macOs]
dev: null
package_description: null
coverage:
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
for_envs: [py37, py36, py35, py34, py27]

- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
- template: publish-pypi.yml@tox
parameters:
- external_feed: 'toxdev'
- pypi_remote: 'pypi-toxdev'
- dependsOn:
- check
- report_coverage
- dependsOn: [fix_lint, docs, package_description, dev, report_coverage]
18 changes: 18 additions & 0 deletions docs/changelog/1290.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Improve python discovery and add architecture support:
- UNIX:

- First, check if the tox host Python matches.
- Second, check if the the canonical name (e.g. ``python3.7``, ``python3``) matches or the base python is an absolute path, use that.
- Third, check if the the canonical name without version matches (e.g. ``python``, ``pypy``) matches.

- Windows:

- First, check if the tox host Python matches.
- Second, use the ``py.exe`` to list registered interpreters and any of those match.
- Third, check if the the canonical name (e.g. ``python3.7``, ``python3``) matches or the base python is an absolute path, use that.
- Fourth, check if the the canonical name without version matches (e.g. ``python``, ``pypy``) matches.
- Finally, check for known locations (``c:\python{major}{minor}\python.exe``).


tox environment configuration generation is now done in parallel (to alleviate the slowdown due to extra
checks).
36 changes: 35 additions & 1 deletion src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import shlex
import string
import sys
import traceback
import warnings
from collections import OrderedDict
from fnmatch import fnmatchcase
from subprocess import list2cmdline
from threading import Thread

import pkg_resources
import pluggy
Expand All @@ -28,6 +30,7 @@
using,
verbosity1,
)
from tox.util.path import ensure_empty_dir

from .parallel import ENV_VAR_KEY as PARALLEL_ENV_VAR_KEY
from .parallel import add_parallel_config, add_parallel_flags
Expand Down Expand Up @@ -1036,6 +1039,9 @@ def line_of_default_to_zero(section, name=None):
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
within_parallel = PARALLEL_ENV_VAR_KEY in os.environ
if not within_parallel:
ensure_empty_dir(config.logdir)

# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
Expand Down Expand Up @@ -1084,6 +1090,18 @@ def line_of_default_to_zero(section, name=None):
known_factors.update(env.split("-"))

# configure testenvs
to_do = []
failures = OrderedDict()
results = {}
cur_self = self

def run(name, section, subs, config):
try:
results[name] = cur_self.make_envconfig(name, section, subs, config)
except Exception as exception:
failures[name] = (exception, traceback.format_exc())

order = []
for name in all_envs:
section = "{}{}".format(testenvprefix, name)
factors = set(name.split("-"))
Expand All @@ -1094,7 +1112,23 @@ def line_of_default_to_zero(section, name=None):
tox.PYTHON.PY_FACTORS_RE.match(factor) for factor in factors - known_factors
)
):
config.envconfigs[name] = self.make_envconfig(name, section, reader._subs, config)
order.append(name)
thread = Thread(target=run, args=(name, section, reader._subs, config))
thread.daemon = True
thread.start()
to_do.append(thread)
for thread in to_do:
while thread.is_alive():
thread.join(timeout=20)
if failures:
raise tox.exception.ConfigError(
"\n".join(
"{} failed with {} at {}".format(key, exc, trace)
for key, (exc, trace) in failures.items()
)
)
for name in order:
config.envconfigs[name] = results[name]
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
Expand Down
1 change: 1 addition & 0 deletions src/tox/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class INFO:
DEFAULT_CONFIG_NAME = "tox.ini"
CONFIG_CANDIDATES = ("pyproject.toml", "tox.ini", "setup.cfg")
IS_WIN = sys.platform == "win32"
IS_PYPY = hasattr(sys, "pypy_version_info")


class PIP:
Expand Down
2 changes: 2 additions & 0 deletions src/tox/helper/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

info = {
"executable": sys.executable,
"name": "pypy" if hasattr(sys, "pypy_version_info") else "python",
"version_info": list(sys.version_info),
"version": sys.version,
"is_64": sys.maxsize > 2 ** 32,
"sysplatform": sys.platform,
}
info_as_dump = json.dumps(info)
Expand Down
Loading