mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
Allow nox 2025.02.09 (#754)
This commit is contained in:
parent
8350f06ea8
commit
acdeeeded2
@ -4,7 +4,6 @@ FROM python:${PYTHON_VERSION}
|
||||
ENV FORCE_COLOR=1
|
||||
|
||||
WORKDIR /code/eland
|
||||
# https://github.com/wntrblm/nox/issues/930
|
||||
RUN python -m pip install nox==2024.10.09
|
||||
RUN python -m pip install nox
|
||||
|
||||
COPY . .
|
||||
|
35
noxfile.py
35
noxfile.py
@ -16,7 +16,6 @@
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import nox
|
||||
@ -78,26 +77,22 @@ def lint(session):
|
||||
session.run("flake8", "--extend-ignore=E203,E402,E501,E704,E712", *SOURCE_FILES)
|
||||
|
||||
# TODO: When all files are typed we can change this to .run("mypy", "--strict", "eland/")
|
||||
session.log("mypy --show-error-codes --strict eland/")
|
||||
for typed_file in TYPED_FILES:
|
||||
if not os.path.isfile(typed_file):
|
||||
session.error(f"The file {typed_file!r} couldn't be found")
|
||||
process = subprocess.run(
|
||||
["mypy", "--show-error-codes", "--strict", typed_file],
|
||||
env=session.env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
# Ensure that mypy itself ran successfully
|
||||
assert process.returncode in (0, 1)
|
||||
stdout = session.run(
|
||||
"mypy",
|
||||
"--show-error-codes",
|
||||
"--strict",
|
||||
*TYPED_FILES,
|
||||
success_codes=(0, 1),
|
||||
silent=True,
|
||||
)
|
||||
|
||||
errors = []
|
||||
for line in process.stdout.decode().split("\n"):
|
||||
filepath = line.partition(":")[0]
|
||||
if filepath in TYPED_FILES:
|
||||
errors.append(line)
|
||||
if errors:
|
||||
session.error("\n" + "\n".join(sorted(set(errors))))
|
||||
errors = []
|
||||
for line in stdout.splitlines():
|
||||
filepath = line.partition(":")[0]
|
||||
if filepath in TYPED_FILES:
|
||||
errors.append(line)
|
||||
if errors:
|
||||
session.error("\n" + "\n".join(sorted(set(errors))))
|
||||
|
||||
|
||||
@nox.session(python=["3.9", "3.10", "3.11", "3.12"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user