MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _tests

Function _tests

noxfile.py:201–329  ·  view source on GitHub ↗
(
    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,
)

Source from the content-addressed store, hash-verified

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

Callers 5

testsFunction · 0.85
coverageFunction · 0.85
github_cext_greenletFunction · 0.85
github_cextFunction · 0.85
github_nocextFunction · 0.85

Calls 11

apply_pytest_optsFunction · 0.90
_setup_for_driverFunction · 0.85
unlinkMethod · 0.80
endswithMethod · 0.45
appendMethod · 0.45
extendMethod · 0.45
getMethod · 0.45
runMethod · 0.45
itemsMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected