Skip to content

Commit 42ead84

Browse files
committedJul 26, 2022
Add CI/CD level tests for extra options
1 parent 9da7440 commit 42ead84

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed
 

‎noxfile.py

+27-13
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,33 @@
1111
db_version = "5.0"
1212

1313

14-
def base_install(session, flask, mongoengine):
14+
def base_install(session, flask, mongoengine, toolbar, wtf):
1515
"""Create basic environment setup for tests and linting."""
16+
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
17+
session.run("python", "-m", "pip", "install", "setuptools_scm[toml]>=6.3.1")
18+
19+
if toolbar and wtf:
20+
extra = "wtf,toolbar,"
21+
elif toolbar:
22+
extra = "toolbar,"
23+
elif wtf:
24+
extra = "wtf,"
25+
else:
26+
extra = ""
27+
1628
if flask == "==1.1.4":
17-
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
18-
session.run("python", "-m", "pip", "install", "setuptools_scm[toml]>=6.3.1")
1929
session.install(
2030
f"Flask{flask}",
2131
f"mongoengine{mongoengine}",
2232
"-e",
23-
".[wtf,toolbar,legacy,legacy-dev]",
33+
f".[{extra}legacy,legacy-dev]",
2434
)
2535
else:
26-
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
27-
session.run("python", "-m", "pip", "install", "setuptools_scm[toml]>=6.3.1")
2836
session.install(
2937
f"Flask{flask}",
3038
f"mongoengine{mongoengine}",
3139
"-e",
32-
".[wtf,toolbar,dev]",
40+
f".[{extra}dev]",
3341
)
3442
return session
3543

@@ -44,9 +52,11 @@ def lint(session):
4452
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3.7"])
4553
@nox.parametrize("flask", ["==1.1.4", "==2.0.3", ">=2.1.2"])
4654
@nox.parametrize("mongoengine", ["==0.21.0", "==0.22.1", "==0.23.1", ">=0.24.1"])
47-
def ci_cd_tests(session, flask, mongoengine):
55+
@nox.parametrize("toolbar", [True, False])
56+
@nox.parametrize("wtf", [True, False])
57+
def ci_cd_tests(session, flask, mongoengine, toolbar, wtf):
4858
"""Run test suite with pytest into ci_cd (no docker)."""
49-
session = base_install(session, flask, mongoengine)
59+
session = base_install(session, flask, mongoengine, toolbar, wtf)
5060
session.run("pytest", *session.posargs)
5161

5262

@@ -71,18 +81,22 @@ def _run_in_docker(session):
7181
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3.7"])
7282
@nox.parametrize("flask", ["==1.1.4", "==2.0.3", ">=2.1.2"])
7383
@nox.parametrize("mongoengine", ["==0.21.0", "==0.22.1", "==0.23.1", ">=0.24.1"])
74-
def full_tests(session, flask, mongoengine):
84+
@nox.parametrize("toolbar", [True, False])
85+
@nox.parametrize("wtf", [True, False])
86+
def full_tests(session, flask, mongoengine, toolbar, wtf):
7587
"""Run tests locally with docker and complete support matrix."""
76-
session = base_install(session, flask, mongoengine)
88+
session = base_install(session, flask, mongoengine, toolbar, wtf)
7789
_run_in_docker(session)
7890

7991

8092
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3.7"])
81-
def latest(session):
93+
@nox.parametrize("toolbar", [True, False])
94+
@nox.parametrize("wtf", [True, False])
95+
def latest(session, toolbar, wtf):
8296
"""Run minimum tests for checking minimum code quality."""
8397
flask = ">=2.1.2"
8498
mongoengine = ">=0.24.1"
85-
session = base_install(session, flask, mongoengine)
99+
session = base_install(session, flask, mongoengine, toolbar, wtf)
86100
if session.interactive:
87101
_run_in_docker(session)
88102
else:

0 commit comments

Comments
 (0)
Please sign in to comment.