-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathnoxfile.py
41 lines (34 loc) · 1.58 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
"""Lint and test boardfarm on multiple python environments."""
import nox
_PYTHON_VERSIONS = ["3.9"]
# Fail nox session when run a program which
# is not installed in its virtualenv
nox.options.error_on_external_run = True
@nox.session(python=_PYTHON_VERSIONS)
def lint(session: nox.Session) -> None:
"""Lint boardfarm."""
session.install("--upgrade", "pip")
session.install("--upgrade", "pip", "wheel")
session.install("--upgrade", "pip", "wheel", ".[dev]")
session.run("black", ".", "--check")
session.run("isort", ".", "--check-only")
session.run("flake8", "boardfarm")
@nox.session(python=_PYTHON_VERSIONS)
def pylint(session: nox.Session) -> None:
"""Lint boardfarm using pylint without dev dependencies."""
session.install("--upgrade", "pip")
session.install("--upgrade", "pip", "wheel")
session.install("--upgrade", "pip", "wheel", ".", "pylint")
# FIXME: boardfarm-lgi-shared is needed because boardfarm imports,
# but it should not be a dependency, as it creates a cycle.
session.install("--upgrade", "pip", "wheel", ".", "pylint", "boardfarm-lgi-shared")
session.run("pylint", "boardfarm")
@nox.session(python=_PYTHON_VERSIONS)
def test(session: nox.Session) -> None:
"""Test boardfarm."""
session.install("--upgrade", "pip")
session.install("--upgrade", "pip", "wheel")
# FIXME: boardfarm-lgi-shared is needed because boardfarm imports,
# but it should not be a dependency, as it creates a cycle.
session.install("--upgrade", "pip", "wheel", ".[test]", "boardfarm-lgi-shared")
session.run("pytest", "unittests")