4242def tests (session : nox .Session ) -> None :
4343 """Run test suite with pytest."""
4444
45- coverage_file = f".coverage.{ sys .platform } .{ session .python } "
45+ coverage_file = f".coverage.pypi. { sys .platform } .{ session .python } "
4646
4747 session .create_tmp () # Fixes permission errors on Windows
4848 session .install (* PYPROJECT ["dependency-groups" ]["test" ], "uv" )
4949 session .install ("-e.[tox_to_nox]" )
50- extra_env = {"PYTHONWARNDEFAULTENCODING" : "1" }
5150 session .run (
5251 "pytest" ,
5352 "--cov" ,
5453 "--cov-config" ,
5554 "pyproject.toml" ,
5655 "--cov-report=" ,
56+ "--numprocesses=auto" ,
57+ "-m" ,
58+ "not conda" ,
5759 * session .posargs ,
5860 env = {
61+ "PYTHONWARNDEFAULTENCODING" : "1" ,
5962 "COVERAGE_FILE" : coverage_file ,
60- ** extra_env ,
6163 },
6264 )
6365
@@ -77,42 +79,47 @@ def minimums(session: nox.Session) -> None:
7779 session .run ("pytest" , * session .posargs )
7880
7981
80- @nox .session (venv_backend = "conda" , default = bool (shutil .which ("conda" )))
81- def conda_tests (session : nox .Session ) -> None :
82- """Run test suite set up with conda."""
82+ def xonda_tests (session : nox .Session , xonda : str ) -> None :
83+ """Run test suite set up with conda/mamba/etc."""
84+
85+ coverage_file = f".coverage.{ xonda } .{ sys .platform } .{ session .python } "
86+
8387 session .conda_install (
8488 "--file" , "requirements-conda-test.txt" , channel = "conda-forge"
8589 )
8690 session .install ("-e." , "--no-deps" )
8791 # Currently, this doesn't work on Windows either with or without quoting
8892 if not sys .platform .startswith ("win32" ):
8993 session .conda_install ("requests<99" )
90- session .run ("pytest" , * session .posargs )
94+ session .run (
95+ "pytest" ,
96+ "--cov" ,
97+ "--cov-config" ,
98+ "pyproject.toml" ,
99+ "--cov-report=" ,
100+ "-m" ,
101+ "conda" ,
102+ * session .posargs ,
103+ env = {"COVERAGE_FILE" : coverage_file },
104+ )
105+
106+
107+ @nox .session (venv_backend = "conda" , default = bool (shutil .which ("conda" )))
108+ def conda_tests (session : nox .Session ) -> None :
109+ """Run test suite set up with conda."""
110+ xonda_tests (session , "conda" )
91111
92112
93113@nox .session (venv_backend = "mamba" , default = shutil .which ("mamba" ))
94114def mamba_tests (session : nox .Session ) -> None :
95115 """Run test suite set up with mamba."""
96- session .conda_install (
97- "--file" , "requirements-conda-test.txt" , channel = "conda-forge"
98- )
99- session .install ("-e." , "--no-deps" )
100- if not sys .platform .startswith ("win32" ):
101- session .conda_install ("requests<99" )
102- session .run ("pytest" , * session .posargs )
116+ xonda_tests (session , "mamba" )
103117
104118
105119@nox .session (venv_backend = "micromamba" , default = shutil .which ("micromamba" ))
106120def micromamba_tests (session : nox .Session ) -> None :
107121 """Run test suite set up with micromamba."""
108- session .conda_install (
109- "--file" , "requirements-conda-test.txt" , channel = "conda-forge"
110- )
111- # Currently, this doesn't work on Windows either with or without quoting
112- session .install ("-e." , "--no-deps" )
113- if not sys .platform .startswith ("win32" ):
114- session .conda_install ("requests<99" )
115- session .run ("pytest" , * session .posargs )
122+ xonda_tests (session , "micromamba" )
116123
117124
118125@nox .session (default = False )
0 commit comments