This repository has been archived by the owner on Aug 8, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnoxfile.py
46 lines (38 loc) · 1.41 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
import nox
DB_PACKAGE = {
"mysql": {
"3.5": ["mysqlclient>=1.3.13"],
"3.6": ["mysqlclient>=1.3.13"],
"3.7": ["mysqlclient>=1.3.13"],
"3.8": ["mysqlclient>=1.3.13"],
},
"postgres": {
"3.5": ["psycopg2>=2.5.4"],
"3.6": ["psycopg2>=2.5.4"],
"3.7": ["psycopg2>=2.5.4"],
"3.8": ["psycopg2>=2.5.4"],
},
}
@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
@nox.parametrize("django", ["2.2.10", "3.0", "3.0.1", "3.0.2", "3.0.3"])
@nox.parametrize("database", ["postgres", "mysql", "sqlite3"])
def tests(session, django, database):
if django.split(".")[0] == "3" and session.python == "3.5":
session.skip("Python: {} and django: {}".format(session.python, django))
if database == "sqlite3" and session.python not in []:
# TODO: Fix me for all python versions.
session.skip("Python: {} and db: {}".format(session.python, database))
if database != "sqlite3":
session.install(
*DB_PACKAGE[database][session.python],
env={
"LDFLAGS": "-L/usr/local/opt/[email protected]/lib",
"CPPFLAGS": "-I/usr/local/opt/[email protected]/include",
}
)
session.install("django=={}".format(django))
session.run("bash", "-c", "make test", external=True, env={"ENV_DB": database})
@nox.session
def lint(session):
session.install("flake8")
session.run("flake8", ".")