1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- from __future__ import absolute_import
18-
1917import pathlib
2018import nox
2119
2220DEFAULT_PYTHON_VERSION = "3.14"
21+ ALL_PYTHON = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" , "3.14" ]
2322CURRENT_DIRECTORY = pathlib .Path (__file__ ).parent .absolute ()
2423REPO_ROOT = CURRENT_DIRECTORY .parent .parent
2524
3130
3231nox .options .sessions = [
3332 "lint" ,
33+ "unit" ,
34+ "prerelease_deps" ,
35+ "core_deps_from_source" ,
3436 "docfx" ,
3537]
3638
3739# Error if a python version is missing
3840nox .options .error_on_missing_interpreters = True
3941
42+ @nox .session (python = ALL_PYTHON )
43+ def unit (session ):
44+ """Run unit tests."""
45+ session .install ("pytest" , "pytest-cov" )
46+ session .install ("-e" , "." )
47+ session .run ("pytest" , "tests" )
48+
49+ @nox .session (python = DEFAULT_PYTHON_VERSION )
50+ def prerelease_deps (session ):
51+ """Run unit tests with prerelease dependencies."""
52+ # Since we have no dependencies, this is just a normal unit test run
53+ # but with --pre enabled for any test tools.
54+ session .install ("pytest" , "pytest-cov" )
55+ session .install ("-e" , "." )
56+ session .run ("pytest" , "tests" )
57+
58+ @nox .session (python = DEFAULT_PYTHON_VERSION )
59+ def core_deps_from_source (session ):
60+ """Run unit tests with core dependencies installed from source."""
61+ # We don't depend on core, so we just run unit tests.
62+ session .install ("pytest" , "pytest-cov" )
63+ session .install ("-e" , "." )
64+ session .run ("pytest" , "tests" )
65+
4066@nox .session (python = DEFAULT_PYTHON_VERSION )
4167def lint (session ):
4268 """Run linters."""
@@ -49,8 +75,11 @@ def docfx(session):
4975 session .install ("PyYAML" , "pypandoc" )
5076
5177 # Construct arguments for the helper script
52- args = [str (CURRENT_DIRECTORY ), str (REPO_ROOT )]
78+ args = [
79+ "--current-dir" , str (CURRENT_DIRECTORY ),
80+ "--repo-root" , str (REPO_ROOT ),
81+ ]
5382 for title , source in DOCS_MAP .items ():
54- args .extend ([title , str (source )])
83+ args .extend (["--doc" , title , str (source )])
5584
5685 session .run ("python" , "docfx_helper.py" , * args )
0 commit comments