4343def tests (session : nox .Session ) -> None :
4444 """Run test suite with pytest."""
4545
46- coverage_file = f".coverage.{ sys .platform } .{ session .python } "
46+ coverage_file = f".coverage.pypi. { sys .platform } .{ session .python } "
4747
4848 session .create_tmp () # Fixes permission errors on Windows
4949 session .install (* PYPROJECT ["dependency-groups" ]["test" ], "uv" )
@@ -55,10 +55,13 @@ def tests(session: nox.Session) -> None:
5555 "--cov-config" ,
5656 "pyproject.toml" ,
5757 "--cov-report=" ,
58+ "--numprocesses=auto" ,
59+ "-m" ,
60+ "not conda" ,
5861 * session .posargs ,
5962 env = {
63+ "PYTHONWARNDEFAULTENCODING" : "1" ,
6064 "COVERAGE_FILE" : coverage_file ,
61- ** extra_env ,
6265 },
6366 )
6467
@@ -78,42 +81,47 @@ def minimums(session: nox.Session) -> None:
7881 session .run ("pytest" , * session .posargs )
7982
8083
81- @nox .session (venv_backend = "conda" , default = bool (shutil .which ("conda" )))
82- def conda_tests (session : nox .Session ) -> None :
83- """Run test suite set up with conda."""
84+ def xonda_tests (session : nox .Session , xonda : str ) -> None :
85+ """Run test suite set up with conda/mamba/etc."""
86+
87+ coverage_file = f".coverage.{ xonda } .{ sys .platform } .{ session .python } "
88+
8489 session .conda_install (
8590 "--file" , "requirements-conda-test.txt" , channel = "conda-forge"
8691 )
8792 session .install ("-e." , "--no-deps" )
8893 # Currently, this doesn't work on Windows either with or without quoting
8994 if not sys .platform .startswith ("win32" ):
9095 session .conda_install ("requests<99" )
91- session .run ("pytest" , * session .posargs )
96+ session .run (
97+ "pytest" ,
98+ "--cov" ,
99+ "--cov-config" ,
100+ "pyproject.toml" ,
101+ "--cov-report=" ,
102+ "-m" ,
103+ "conda" ,
104+ * session .posargs ,
105+ env = {"COVERAGE_FILE" : coverage_file },
106+ )
107+
108+
109+ @nox .session (venv_backend = "conda" , default = bool (shutil .which ("conda" )))
110+ def conda_tests (session : nox .Session ) -> None :
111+ """Run test suite set up with conda."""
112+ xonda_tests (session , "conda" )
92113
93114
94115@nox .session (venv_backend = "mamba" , default = shutil .which ("mamba" ))
95116def mamba_tests (session : nox .Session ) -> None :
96117 """Run test suite set up with mamba."""
97- session .conda_install (
98- "--file" , "requirements-conda-test.txt" , channel = "conda-forge"
99- )
100- session .install ("-e." , "--no-deps" )
101- if not sys .platform .startswith ("win32" ):
102- session .conda_install ("requests<99" )
103- session .run ("pytest" , * session .posargs )
118+ xonda_tests (session , "mamba" )
104119
105120
106121@nox .session (venv_backend = "micromamba" , default = shutil .which ("micromamba" ))
107122def micromamba_tests (session : nox .Session ) -> None :
108123 """Run test suite set up with micromamba."""
109- session .conda_install (
110- "--file" , "requirements-conda-test.txt" , channel = "conda-forge"
111- )
112- # Currently, this doesn't work on Windows either with or without quoting
113- session .install ("-e." , "--no-deps" )
114- if not sys .platform .startswith ("win32" ):
115- session .conda_install ("requests<99" )
116- session .run ("pytest" , * session .posargs )
124+ xonda_tests (session , "micromamba" )
117125
118126
119127@nox .session (default = False )
0 commit comments