Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Python commands in tox in isolated and strict mode #562

Merged
Merged
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
89 changes: 72 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ minversion = 3.14.0
deps =
-rrequirements/tests.in
commands_pre =
{envpython} -m \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m \
OpenSSL.debug
commands =
{envpython} -m \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m \
pytest \
{tty:--color=yes} \
{posargs:}
install_command =
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
{toxinidir}/bin/pip-wrapper \
'{envname}' \
'{toxinidir}/requirements/' \
Expand Down Expand Up @@ -48,6 +56,14 @@ setenv =
WEBTEST_INTERACTIVE=false


[python-cli-options]
byteerrors = -bb
bytewarnings = -b
# isolate = -I
# FIXME: Python 2 shim. Is this equivalent to the above?
isolate = -E -s


[dists]
setenv =
PIP_CONSTRAINT = {toxinidir}/requirements/dist-build-constraints.txt
Expand All @@ -71,7 +87,10 @@ commands =
# FIXME: instead of `{toxworkdir}/.tmp` that was added in tox v3.16.1.
# NOTE: The last tox supporting Python 3.4 is 3.14.0
# -d "{temp_dir}/.doctrees" \
{envpython} -m sphinx \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m sphinx \
-j auto \
-b html \
{tty:--color} \
Expand All @@ -83,7 +102,10 @@ commands =
"{envdir}/docs_out"

# Print out the output docs dir and a way to serve html:
-{envpython} -c\
-{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-c\
'import pathlib;\
docs_dir = pathlib.Path(r"{envdir}") / "docs_out";\
index_file = docs_dir / "index.html";\
Expand All @@ -106,8 +128,11 @@ commands =
-git fetch --unshallow
-git fetch --tags

# Spellcheck docs site:
python -m sphinx \
# Doctest docs site:
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m sphinx \
-j auto \
-a -n -W \
--keep-going \
Expand All @@ -129,8 +154,11 @@ commands =
-git fetch --unshallow
-git fetch --tags

# Spellcheck docs site:
python -m sphinx \
# Linkcheck docs site:
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m sphinx \
-j auto \
-a -n -W \
--keep-going \
Expand All @@ -153,7 +181,10 @@ commands =
-git fetch --tags

# Spellcheck docs site:
python -m sphinx \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m sphinx \
-j auto \
-a -n -W \
--keep-going \
Expand All @@ -179,8 +210,14 @@ deps =
usedevelop = False
commands_pre =
commands =
python -m twine check .tox/dist/*
python -m setuptools_scm ls
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m twine check .tox/dist/*
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m setuptools_scm ls


[testenv:cleanup-dists]
Expand All @@ -193,7 +230,10 @@ setenv =
{[dists]setenv}
commands_pre =
commands =
{envpython} -c \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-c \
'import os, shutil, sys; dists_dir = os.getenv("PEP517_OUT_DIR"); shutil.rmtree(dists_dir, ignore_errors=True); sys.exit(os.path.exists(dists_dir))'


Expand All @@ -211,6 +251,8 @@ platform = darwin|linux
install_command =
env PIP_CONSTRAINT= \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
{toxinidir}/bin/pip-wrapper \
'{envname}' \
'{toxinidir}/requirements/' \
Expand All @@ -231,7 +273,10 @@ commands =
# if no format arguments are passed. This makes sure that
# wheels are not dependent on the Git repo or anything
# external what may be missing from sdist.
{envpython} -m build \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-m build \
--outdir '{env:PEP517_OUT_DIR}/' \
{posargs:{env:PEP517_BUILD_ARGS:}} \
'{toxinidir}'
Expand All @@ -251,7 +296,10 @@ commands_pre =
setenv =
{[dists]setenv}
commands =
{envpython} -m twine check \
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate}
-m twine check \
--strict \
{env:PEP517_OUT_DIR}/*

Expand All @@ -267,6 +315,13 @@ setenv =
TWINE_USERNAME = {env:TWINE_USERNAME:__token__}
commands_pre =
commands =
python -c "import path; path.Path('dist').rmtree_p()"
python -m pep517.build .
python -m twine upload dist/*
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} \
-c "import path; path.Path('dist').rmtree_p()"
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} -m pep517.build .
{envpython} \
{[python-cli-options]byteerrors} \
{[python-cli-options]isolate} -m twine upload dist/*