Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a9937f4

Browse files
update tox.ini
1 parent eaa0085 commit a9937f4

File tree

1 file changed

+32
-65
lines changed

1 file changed

+32
-65
lines changed

‎tox.ini‎

Lines changed: 32 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,6 @@
11
#: -- TOX CONFIG -----------------------------------------------------------------------
2-
[variables]
3-
package = python_test
4-
5-
6-
[python_cmd]
7-
#: HACK: Add `devtools.debug()` to `__builtins__` via `_debug.pth` in venv site-packages
8-
debug_glob_import =
9-
python -c \
10-
'f=open(r"{envsitepackagesdir}/_debug.pth","w"); \
11-
f.write("import devtools;__builtins__.update(debug=devtools.debug)\n"); \
12-
f.close()'
13-
pdbrc =
14-
python -c \
15-
'f=open(".pdbrc","w"); \
16-
f.write("""import IPython\n"""); \
17-
f.write("""from traitlets.config import get_config\n\n"""); \
18-
f.write("""cfg = get_config()\n"""); \
19-
f.write("""cfg.InteractiveShellEmbed.colors = "Linux"\n"""); \
20-
f.write("""cfg.InteractiveShellEmbed.confirm_exit = False\n\n"""); \
21-
f.write("""# Use IPython for interact\nalias interacti IPython.embed(config=cfg)\n\n"""); \
22-
f.write("""# Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names\n"""); \
23-
f.write("""alias p_ for k in sorted(%1.keys()): print("%s%-15s= %-80.80s" % ("%2",k,repr(%1[k]))\n\n"""); \
24-
f.write("""# Print member vars of a thing\nalias pi p_ %1.__dict__ %1.\n\n"""); \
25-
f.write("""# Print member vars of self\nalias ps pi self\n\n"""); \
26-
f.write("""# Print locals\nalias pl p_ locals() local:\n\n"""); \
27-
f.write("""# Next and list\nalias nl n;;l\n\n"""); \
28-
f.write("""# Step and list\nalias sl s;;l\n"""); \
29-
f.close()'
30-
safety_poetry_req_file =
31-
python -c \
32-
'f=open(r"{envtmpdir}/safety.py","w"); \
33-
f.write("""import subprocess\n"""); \
34-
f.write("""import re\n"""); \
35-
f.write("""with open("{envtmpdir}/requirements.txt","w") as f:\n"""); \
36-
f.write(""" cmd = subprocess.run(["poetry", "show"], capture_output=True)\n"""); \
37-
f.write(""" cmd.check_returncode()\n"""); \
38-
f.write(""" f.write(re.sub(r\"([\\w-]+)[ (!)]+([\\d.a-z-]+).*\", r\"\\1==\\2\", cmd.stdout.decode()))\n"""); \
39-
f.close()'
40-
py_exe_location = python -c 'print("PYTHON INTERPRETER LOCATION: " + r"{envpython}")'
41-
#: Output link to index.html
42-
sphinx_html_doc_location =
43-
python -c \
44-
'from pathlib import Path; \
45-
index_file = Path(r"{toxinidir}")/"docs/build/html/index.html"; \
46-
print(f"DOCUMENTATION AVAILABLE UNDER: \{index_file.as_uri()\}")'
47-
pre_commit_install_hint =
48-
python -c \
49-
'from pathlib import Path; \
50-
exe = Path(r"{envbindir}")/"pre-commit"; \
51-
print(f"""HINT: to add checks as pre-commit hook run: "\{exe\} install".""")'
52-
53-
542
[tox]
3+
package = python_test
554
minversion = 3.15.0
565
#: For locally skipping missing interpreters use `tox -s false`
576
skip_missing_interpreters = true
@@ -74,8 +23,6 @@ passenv =
7423
PYTEST_*
7524
HOME
7625
CI
77-
TRAVIS
78-
TRAVIS_*
7926
setenv =
8027
PIP_DISABLE_VERSION_CHECK = 1
8128
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
@@ -92,7 +39,10 @@ extras =
9239
ignore_errors = true
9340
commands =
9441
pre-commit run {posargs} --all-files --show-diff-on-failure
95-
{[python_cmd]pre_commit_install_hint}
42+
python -c \
43+
'from pathlib import Path; \
44+
exe = Path(r"{envbindir}")/"pre-commit"; \
45+
print(f"""HINT: to add checks as pre-commit hook run: "\{exe\} install".""")'
9646

9747

9848
[testenv:safety]
@@ -102,26 +52,37 @@ deps =
10252
poetry>=0.12
10353
safety
10454
commands =
105-
{[python_cmd]safety_poetry_req_file}
55+
#: write py script creating requirements.txt
56+
python -c \
57+
'f=open(r"{envtmpdir}/safety.py","w"); \
58+
f.write("""import subprocess\n"""); \
59+
f.write("""import re\n"""); \
60+
f.write("""with open("{envtmpdir}/requirements.txt","w") as f:\n"""); \
61+
f.write(""" cmd = subprocess.run(["poetry", "show"], capture_output=True)\n"""); \
62+
f.write(""" cmd.check_returncode()\n"""); \
63+
f.write(""" f.write(re.sub(r\"([\\w-]+)[ (!)]+([\\d.a-z-]+).*\", r\"\\1==\\2\", cmd.stdout.decode()))\n"""); \
64+
f.close()'
10665
python {envtmpdir}/safety.py
10766
safety check -r {envtmpdir}/requirements.txt --full-report
10867

10968

110-
[testenv:py3{8,7,6}]
69+
[testenv:py{py3,39,38,37,36}]
11170
description = run tests with {basepython}
11271
extras = testing
11372
commands =
11473
pytest \
11574
--basetemp="{envtmpdir}" \
116-
--cov "{envsitepackagesdir}/{[variables]package}" \
75+
--cov "{envsitepackagesdir}/{[tox]package}" \
11776
--cov-fail-under 0 \
77+
--junitxml {toxworkdir}/junit.{envname}.xml \
78+
-n={env:PYTEST_XDIST_N:auto} \
11879
{posargs:tests}
11980

12081

12182
[testenv:coverage]
12283
description = combine coverage data and create report; generates a diff coverage
12384
against origin/master (can be changed by setting DIFF_AGAINST env var)
124-
depends = py{py3,38,37,36}
85+
depends = py{py3,39,38,37,36}
12586
passenv =
12687
{[testenv]passenv}
12788
DIFF_AGAINST
@@ -141,29 +102,35 @@ commands =
141102

142103
[testenv:package]
143104
description = check sdist and wheel
144-
skip_install = True
105+
skip_install = true
145106
deps =
146-
twine
147107
poetry>=0.12
108+
twine
148109
commands =
149-
poetry build
110+
poetry build -vvv
150111
twine check dist/*
151112

152113

153114
[testenv:dev]
154115
description = create dev env
155116
deps =
156117
safety
118+
flake8>=3.8.3
119+
bandit>=1.6.2
120+
pydocstyle>=5.1.0
121+
rstcheck>=3.3.1
157122
skip_install = true
158123
whitelist_externals = poetry
159124
commands =
160125
poetry install -E "testing pre-commit"
161126
#: HACK: Add `devtools.debug()` to `__builtins__` via `_debug.pth` in venv site-packages
162-
{[python_cmd]debug_glob_import}
163-
{[python_cmd]pdbrc}
127+
python -c \
128+
'f=open(r"{envsitepackagesdir}/_debug.pth","w"); \
129+
f.write("import devtools;__builtins__.update(debug=devtools.debug)\n"); \
130+
f.close()'
164131
python -m pip list --format=columns
165132
safety check --full-report
166-
{[python_cmd]py_exe_location}
133+
python -c 'print("PYTHON INTERPRETER LOCATION: " + r"{envpython}")'
167134

168135

169136
#: -- MYPY CONFIG ----------------------------------------------------------------------

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /