(
session: nox.Session,
database: str,
cext: str = "_auto",
greenlet: bool = True,
backendonly: bool = False,
platform_intensive: bool = False,
timing_intensive: bool = True,
coverage: bool = False,
)
| 192 | |
| 193 | |
| 194 | def _tests( |
| 195 | session: nox.Session, |
| 196 | database: str, |
| 197 | cext: str = class="st">"_auto", |
| 198 | greenlet: bool = True, |
| 199 | backendonly: bool = False, |
| 200 | platform_intensive: bool = False, |
| 201 | timing_intensive: bool = True, |
| 202 | coverage: bool = False, |
| 203 | ) -> None: |
| 204 | |
| 205 | class="cm"># ensure external PYTHONPATH not interfering |
| 206 | session.env[class="st">"PYTHONPATH"] = class="st">"" |
| 207 | |
| 208 | class="cm"># PYTHONNOUSERSITE - this *MUST* be set so that the ./lib/ import |
| 209 | class="cm"># set up explicitly in test/conftest.py is *disabled*, so that |
| 210 | class="cm"># when SQLAlchemy is built into the .nox area, we use that and not the |
| 211 | class="cm"># local checkout, at least when usedevelop=False |
| 212 | session.env[class="st">"PYTHONNOUSERSITE"] = class="st">"1" |
| 213 | |
| 214 | freethreaded = isinstance(session.python, str) and session.python.endswith( |
| 215 | class="st">"t" |
| 216 | ) |
| 217 | |
| 218 | if freethreaded: |
| 219 | session.env[class="st">"PYTHON_GIL"] = class="st">"0" |
| 220 | |
| 221 | class="cm"># greenlet frequently crashes with freethreading, so omit |
| 222 | class="cm"># for the near future |
| 223 | greenlet = False |
| 224 | |
| 225 | session.env[class="st">"SQLALCHEMY_WARN_20"] = class="st">"1" |
| 226 | |
| 227 | if cext == class="st">"cext": |
| 228 | session.env[class="st">"REQUIRE_SQLALCHEMY_CEXT"] = class="st">"1" |
| 229 | elif cext == class="st">"nocext": |
| 230 | session.env[class="st">"DISABLE_SQLALCHEMY_CEXT"] = class="st">"1" |
| 231 | |
| 232 | includes_excludes: dict[str, list[str]] = {class="st">"k": [], class="st">"m": []} |
| 233 | |
| 234 | if coverage: |
| 235 | timing_intensive = False |
| 236 | |
| 237 | if platform_intensive: |
| 238 | class="cm"># platform_intensive refers to test/aaa_profiling/test_memusage.py. |
| 239 | class="cm"># it's only run exclusively of all other tests. does not include |
| 240 | class="cm"># greenlet related tests |
| 241 | greenlet = False |
| 242 | class="cm"># with class="st">"-m memory_intensive", only that suite will run, all |
| 243 | class="cm"># other tests will be deselected by pytest |
| 244 | includes_excludes[class="st">"m"].append(class="st">"memory_intensive") |
| 245 | elif backendonly: |
| 246 | class="cm"># with class="st">"-m backendonly", only tests with the backend pytest mark |
| 247 | class="cm"># (or pytestplugin equivalent, like __backend__) will be selected |
| 248 | class="cm"># by pytest. |
| 249 | class="cm"># memory intensive is deselected to prevent these from running |
| 250 | includes_excludes[class="st">"m"].extend([class="st">"backend", class="st">"not memory_intensive"]) |
| 251 | else: |
no test coverage detected