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\n alias 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\n alias pi p_ %1.__dict__ %1.\n\n """); \ 
25-  f.write("""# Print member vars of self\n alias ps pi self\n\n """); \ 
26-  f.write("""# Print locals\n alias pl p_ locals() local:\n\n """); \ 
27-  f.write("""# Next and list\n alias nl n;;l\n\n """); \ 
28-  f.write("""# Step and list\n alias 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
554minversion  = 3.15.0
565# : For locally skipping missing interpreters use `tox -s false`
576skip_missing_interpreters  = true
@@ -74,8 +23,6 @@ passenv =
7423 PYTEST_*
7524 HOME
7625 CI
77-  TRAVIS
78-  TRAVIS_*
7926setenv  =
8027 PIP_DISABLE_VERSION_CHECK  = 1
8128 COVERAGE_FILE  = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
@@ -92,7 +39,10 @@ extras =
9239ignore_errors  = true
9340commands  =
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
10454commands  =
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 }] 
11170description  = run tests with {basepython}
11271extras  = testing
11372commands  =
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] 
12283description  = 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}
12586passenv  =
12687 {[testenv]passenv}
12788 DIFF_AGAINST
@@ -141,29 +102,35 @@ commands =
141102
142103[testenv:package] 
143104description  = check sdist and wheel
144- skip_install  = True 
105+ skip_install  = true 
145106deps  =
146-  twine
147107 poetry>=0.12
108+  twine
148109commands  =
149-  poetry build
110+  poetry build -vvv 
150111 twine check dist/*
151112
152113
153114[testenv:dev] 
154115description  = create dev env
155116deps  =
156117 safety
118+  flake8>=3.8.3
119+  bandit>=1.6.2
120+  pydocstyle>=5.1.0
121+  rstcheck>=3.3.1
157122skip_install  = true
158123whitelist_externals  = poetry
159124commands  =
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