Skip to content

Commit

Permalink
chore: Few tidy ups (#612)
Browse files Browse the repository at this point in the history
* noxfile and pyproject.toml tidy ups

* Put session.create_tmp() back for Windows
  • Loading branch information
FollowTheProcess committed May 2, 2022
1 parent 6d6af56 commit c713ee1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ on: [push, pull_request]
env:
FORCE_COLOR: "1"
PRE_COMMIT_COLOR: "always"
# See https://github.com/theacodes/nox/issues/545
# and https://github.com/pre-commit/pre-commit/issues/2178#issuecomment-1002163763
SETUPTOOLS_USE_DISTUTILS: "stdlib"
jobs:
build:
runs-on: ${{ matrix.os }}
Expand Down
17 changes: 7 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@


@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
def tests(session):
def tests(session: nox.Session) -> None:
"""Run test suite with pytest."""
session.create_tmp()
session.create_tmp() # Fixes permission errors on Windows
session.install("-r", "requirements-test.txt")
session.install("-e", ".[tox_to_nox]")
session.run(
Expand All @@ -49,9 +49,9 @@ def tests(session):


@nox.session(python=["3.7", "3.8", "3.9", "3.10"], venv_backend="conda")
def conda_tests(session):
def conda_tests(session: nox.Session) -> None:
"""Run test suite with pytest."""
session.create_tmp()
session.create_tmp() # Fixes permission errors on Windows
session.conda_install(
"--file", "requirements-conda-test.txt", "--channel", "conda-forge"
)
Expand All @@ -60,7 +60,7 @@ def conda_tests(session):


@nox.session
def cover(session):
def cover(session: nox.Session) -> None:
"""Coverage analysis."""
if ON_WINDOWS_CI:
return
Expand All @@ -72,24 +72,21 @@ def cover(session):


@nox.session(python="3.9")
def lint(session):
def lint(session: nox.Session) -> None:
"""Run pre-commit linting."""
session.install("pre-commit")
# See https://github.com/theacodes/nox/issues/545
# and https://github.com/pre-commit/pre-commit/issues/2178#issuecomment-1002163763
session.run(
"pre-commit",
"run",
"--all-files",
"--show-diff-on-failure",
"--hook-stage=manual",
env={"SETUPTOOLS_USE_DISTUTILS": "stdlib"},
*session.posargs,
)


@nox.session
def docs(session):
def docs(session: nox.Session) -> None:
"""Build the documentation."""
output_dir = os.path.join(session.create_tmp(), "output")
doctrees, html = map(
Expand Down
18 changes: 5 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,29 @@ profile = "black"

[tool.coverage.run]
branch = true
omit = [
"nox/_typing.py",
]
omit = ["nox/_typing.py"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if _typing.TYPE_CHECKING:",
"@overload",
]
exclude_lines = ["pragma: no cover", "if _typing.TYPE_CHECKING:", "@overload"]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = ["-ra", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = ["error"]
log_cli_level = "info"
testpaths = [
"tests",
]
testpaths = ["tests"]

[tool.mypy]
files = ["nox"]
files = ["nox/**/*.py", "noxfile.py"]
python_version = "3.7"
show_error_codes = true
strict = true
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]

[[tool.mypy.overrides]]
module = [ "argcomplete", "colorlog.*", "py", "tox.*" ]
module = ["argcomplete", "colorlog.*", "py", "tox.*"]
ignore_missing_imports = true

[tool.check-manifest]
Expand Down

0 comments on commit c713ee1

Please sign in to comment.