forked from facebookresearch/mtrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
51 lines (37 loc) · 1.33 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# type: ignore
import os
import nox
from nox.sessions import Session
DEFAULT_PYTHON_VERSIONS = ["3.7", "3.8", "3.9"]
PYTHON_VERSIONS = os.environ.get(
"NOX_PYTHON_VERSIONS", ",".join(DEFAULT_PYTHON_VERSIONS)
).split(",")
code_paths_to_test = ["mtrl", "tests", "main.py"]
config_paths_to_test = ["config"]
def setup(session: Session) -> None:
session.install("--upgrade", "setuptools", "pip")
session.install("-r", "requirements/nox.txt")
@nox.session(python=PYTHON_VERSIONS)
def lint(session):
setup(session)
for _path in code_paths_to_test:
session.run("flake8", _path)
session.run("black", "--check", _path)
session.run("isort", _path, "--check", "--diff")
@nox.session(python=PYTHON_VERSIONS)
def mypy(session):
setup(session)
for _path in code_paths_to_test:
session.run("mypy", _path)
@nox.session(python=PYTHON_VERSIONS)
def yamllint(session):
setup(session)
for _path in config_paths_to_test:
session.run("yamllint", _path)
# @nox.session(python=PYTHON_VERSIONS)
# # @nox.session(venv_backend="conda")
# def pytest(session):
# session.install("--upgrade", "setuptools", "pip")
# session.install("-r", "requirements.txt")
# session.run("pytest", "tests", env={"PYTHONPATH": "."})