|
| 1 | +requires = ["tox>=4.19"] |
| 2 | +env_list = ["fix", "3.13", "3.12", "3.11", "3.10", "3.9", "3.8", "cov", "type", "docs", "pkg_meta"] |
| 3 | +skip_missing_interpreters = true |
| 4 | + |
| 5 | +[env_run_base] |
| 6 | +description = "run the tests with pytest under {env_name}" |
| 7 | +package = "wheel" |
| 8 | +wheel_build_env = ".pkg" |
| 9 | +extras = ["testing"] |
| 10 | +pass_env = ["PYTEST_*", "SSL_CERT_FILE"] |
| 11 | +set_env.COVERAGE_FILE = { type = "env", name = "COVERAGE_FILE", default = "{work_dir}{/}.coverage.{env_name}" } |
| 12 | +set_env.COVERAGE_FILECOVERAGE_PROCESS_START = "{tox_root}{/}pyproject.toml" |
| 13 | +commands = [ |
| 14 | + [ |
| 15 | + "pytest", |
| 16 | + { type = "posargs", default = [ |
| 17 | + "--junitxml", |
| 18 | + "{work_dir}{/}junit.{env_name}.xml", |
| 19 | + "--cov", |
| 20 | + "{env_site_packages_dir}{/}tox", |
| 21 | + "--cov", |
| 22 | + "{tox_root}{/}tests", |
| 23 | + "--cov-config={tox_root}{/}pyproject.toml", |
| 24 | + "-no-cov-on-fail", |
| 25 | + "--cov-report", |
| 26 | + "term-missing:skip-covered", |
| 27 | + "--cov-context=test", |
| 28 | + "--cov-report", |
| 29 | + "html:{env_tmp_dir}{/}htmlcov", |
| 30 | + "--cov-report", |
| 31 | + "xml:{work_dir}{/}coverage.{env_name}.xml", |
| 32 | + "-n", |
| 33 | + { type = "env", name = "PYTEST_XDIST_AUTO_NUM_WORKERS", default = "auto" }, |
| 34 | + "tests", |
| 35 | + "--durations", |
| 36 | + "15", |
| 37 | + "--run-integration", |
| 38 | + ] }, |
| 39 | + ], |
| 40 | + [ |
| 41 | + "diff-cover", |
| 42 | + "--compare-branch", |
| 43 | + { type = "env", name = "DIFF_AGAINST", default = "origin/main" }, |
| 44 | + "{work_dir}{/}coverage.{env_name}.xml", |
| 45 | + ], |
| 46 | +] |
| 47 | + |
| 48 | +[env.fix] |
| 49 | +description = "format the code base to adhere to our styles, and complain about what we cannot do automatically" |
| 50 | +skip_install = true |
| 51 | +deps = ["pre-commit-uv>=4.1.3"] |
| 52 | +pass_env = [{ type = "ref", of = ["env_run_base", "pass_env"] }, "PROGRAMDATA"] |
| 53 | +commands = [["pre-commit", "run", "--all-files", "--show-diff-on-failure", { type = "posargs" }]] |
| 54 | + |
| 55 | +[env.type] |
| 56 | +description = "run type check on code base" |
| 57 | +deps = ["mypy==1.11.2", "types-cachetools>=5.5.0.20240820", "types-chardet>=5.0.4.6"] |
| 58 | +commands = [["mypy", "src/tox"], ["mypy", "tests"]] |
| 59 | + |
| 60 | +[env.docs] |
| 61 | +description = "build documentation" |
| 62 | +extras = ["docs"] |
| 63 | +commands = [ |
| 64 | + { type = "posargs", default = [ |
| 65 | + "sphinx-build", |
| 66 | + "-d", |
| 67 | + "{env_tmp_dir}{/}docs_tree", |
| 68 | + "docs", |
| 69 | + "{work_dir}{/}docs_out", |
| 70 | + "--color", |
| 71 | + "-b", |
| 72 | + "linkcheck", |
| 73 | + ] }, |
| 74 | + [ |
| 75 | + "sphinx-build", |
| 76 | + "-d", |
| 77 | + "{env_tmp_dir}{/}docs_tree", |
| 78 | + "docs", |
| 79 | + "{work_dir}{/}docs_out", |
| 80 | + "--color", |
| 81 | + "-b", |
| 82 | + "html", |
| 83 | + "-W", |
| 84 | + ], |
| 85 | + [ |
| 86 | + "python", |
| 87 | + "-c", |
| 88 | + 'print(r"documentation available under file://{work_dir}{/}docs_out{/}index.html")', |
| 89 | + ], |
| 90 | +] |
| 91 | + |
| 92 | + |
| 93 | +[env.pkg_meta] |
| 94 | +description = "check that the long description is valid" |
| 95 | +skip_install = true |
| 96 | +deps = ["check-wheel-contents>=0.6", "twine>=5.1.1", "uv>=0.4.17"] |
| 97 | +commands = [ |
| 98 | + [ |
| 99 | + "uv", |
| 100 | + "build", |
| 101 | + "--sdist", |
| 102 | + "--wheel", |
| 103 | + "--out-dir", |
| 104 | + "{env_tmp_dir}", |
| 105 | + ".", |
| 106 | + ], |
| 107 | + [ |
| 108 | + "twine", |
| 109 | + "check", |
| 110 | + "{env_tmp_dir}{/}*", |
| 111 | + ], |
| 112 | + [ |
| 113 | + "check-wheel-contents", |
| 114 | + "--no-config", |
| 115 | + "{env_tmp_dir}", |
| 116 | + ], |
| 117 | +] |
| 118 | + |
| 119 | +[env.release] |
| 120 | +description = "do a release, required posargs of the version number" |
| 121 | +skip_install = true |
| 122 | +deps = ["gitpython>=3.1.43", "packaging>=24.1", "towncrier>=24.8"] |
| 123 | +commands = [["python", "{tox_root}/tasks/release.py", "--version", "{posargs}"]] |
| 124 | + |
| 125 | +[env.dev] |
| 126 | +description = "dev environment with all deps at {envdir}" |
| 127 | +package = "editable" |
| 128 | +deps = { type = "ref", of = ["env", "release", "deps"] } |
| 129 | +extras = ["docs", "testing"] |
| 130 | +commands = [["python", "-m", "pip", "list", "--format=columns"], ["python", "-c", 'print(r"{env_python}")']] |
| 131 | +uv_seed = true |
0 commit comments