Skip to content

Commit 1c73ab4

Browse files
committed
Segregate test and doctest installs
1 parent 4890b82 commit 1c73ab4

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

noxfile.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def parametrize_test_versions():
9292
PARAMETRIZED_TEST_VERSIONS = parametrize_test_versions()
9393

9494

95+
def install_dependencies(session, session_name, sqlalchemy_version):
96+
"""Install dependencies for the given session."""
97+
session.install(
98+
"-r", f"requirements-{session_name}.txt",
99+
f"sqlalchemy~={sqlalchemy_version}.0",
100+
"-e", "."
101+
)
102+
103+
95104
@nox.session()
96105
@nox.parametrize("python,sqlalchemy", PARAMETRIZED_TEST_VERSIONS)
97106
def test(session, sqlalchemy):
@@ -109,9 +118,7 @@ def test(session, sqlalchemy):
109118
110119
For fine-grained control over running the tests, refer the nox documentation: https://nox.thea.codes/en/stable/usage.html
111120
"""
112-
session.install("-r", "requirements-test.txt")
113-
session.install(f"sqlalchemy~={sqlalchemy}.0")
114-
session.install("-e", ".")
121+
install_dependencies(session, "test", sqlalchemy)
115122
pytest_args = session.posargs or ["--pyargs", "sqlalchemy_mptt"]
116123
session.run("pytest", *pytest_args, env={"SQLALCHEMY_WARN_20": "1"})
117124

@@ -120,9 +127,7 @@ def test(session, sqlalchemy):
120127
@nox.parametrize("python,sqlalchemy", PARAMETRIZED_TEST_VERSIONS[-1:])
121128
def doctest(session, sqlalchemy):
122129
"""Run doctests in the documentation."""
123-
session.install("sphinx")
124-
session.install(f"sqlalchemy~={sqlalchemy}.0")
125-
session.install("-e", ".")
130+
install_dependencies(session, "doctest", sqlalchemy)
126131
session.run("sphinx-build", "-b", "doctest", "docs", "docs/_build")
127132

128133

requirements-docs.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements-doctest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flask-sqlalchemy
2+
sphinx

requirements-test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
hypothesis
22
pytest
33
pytest-cov
4-
sphinx

0 commit comments

Comments
 (0)