-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnoxfile.py
52 lines (42 loc) · 1.4 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
52
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import nox
import os
DEFAULT_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
PYTHON_VERSIONS = os.environ.get(
"NOX_PYTHON_VERSIONS", ",".join(DEFAULT_PYTHON_VERSIONS)
).split(",")
VERBOSE = os.environ.get("VERBOSE", "0")
SILENT = VERBOSE == "0"
# Linted dirs/files:
lint_targets = "."
# Test dirs (corresponds to each project having its own tests folder):
# Note the './', this installs local packages
test_targets = [
"./" + p.rstrip("\n") for p in open("hydra-configs-projects.txt", "r").readlines()
]
def setup_dev_env(session):
session.run(
"python",
"-m",
"pip",
"install",
"--upgrade",
"setuptools",
"pip",
silent=SILENT,
)
session.run("pip", "install", "-r", "requirements/dev.txt", silent=SILENT)
@nox.session(python=PYTHON_VERSIONS, reuse_venv=True)
def lint(session):
setup_dev_env(session)
session.run("black", *lint_targets, "--check")
session.run("flake8", "--config", ".flake8", *lint_targets)
@nox.session(python=PYTHON_VERSIONS, reuse_venv=True)
def tests(session):
setup_dev_env(session)
for target in test_targets:
session.run(
"pip", "install", "-r", target + "/requirements/dev.txt", silent=SILENT
)
session.install(*test_targets) # install config packages
session.run("pytest", *test_targets)