Current Path: > > opt > hc_python > lib > python3.12 > site-packages > alembic > > > > testing
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
plugin | Directory | - | - | |
suite | Directory | - | - | |
__init__.py | File | 1159 bytes | April 04 2025 08:02:35. | |
assertions.py | File | 5196 bytes | April 04 2025 08:02:35. | |
env.py | File | 10537 bytes | April 04 2025 08:02:35. | |
fixtures.py | File | 9127 bytes | April 04 2025 08:02:35. | |
requirements.py | File | 4180 bytes | April 04 2025 08:02:35. | |
schemacompare.py | File | 4838 bytes | April 04 2025 08:02:35. | |
util.py | File | 3350 bytes | April 04 2025 08:02:35. | |
warnings.py | File | 831 bytes | April 04 2025 08:02:35. |
# testing/util.py # Copyright (C) 2005-2019 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from __future__ import annotations import types from typing import Union from sqlalchemy.util import inspect_getfullargspec from ..util import sqla_2 def flag_combinations(*combinations): """A facade around @testing.combinations() oriented towards boolean keyword-based arguments. Basically generates a nice looking identifier based on the keywords and also sets up the argument names. E.g.:: @testing.flag_combinations( dict(lazy=False, passive=False), dict(lazy=True, passive=False), dict(lazy=False, passive=True), dict(lazy=False, passive=True, raiseload=True), ) would result in:: @testing.combinations( ('', False, False, False), ('lazy', True, False, False), ('lazy_passive', True, True, False), ('lazy_passive', True, True, True), id_='iaaa', argnames='lazy,passive,raiseload' ) """ from sqlalchemy.testing import config keys = set() for d in combinations: keys.update(d) keys = sorted(keys) return config.combinations( *[ ("_".join(k for k in keys if d.get(k, False)),) + tuple(d.get(k, False) for k in keys) for d in combinations ], id_="i" + ("a" * len(keys)), argnames=",".join(keys), ) def resolve_lambda(__fn, **kw): """Given a no-arg lambda and a namespace, return a new lambda that has all the values filled in. This is used so that we can have module-level fixtures that refer to instance-level variables using lambdas. """ pos_args = inspect_getfullargspec(__fn)[0] pass_pos_args = {arg: kw.pop(arg) for arg in pos_args} glb = dict(__fn.__globals__) glb.update(kw) new_fn = types.FunctionType(__fn.__code__, glb) return new_fn(**pass_pos_args) def metadata_fixture(ddl="function"): """Provide MetaData for a pytest fixture.""" from sqlalchemy.testing import config from . import fixture_functions def decorate(fn): def run_ddl(self): from sqlalchemy import schema metadata = self.metadata = schema.MetaData() try: result = fn(self, metadata) metadata.create_all(config.db) # TODO: # somehow get a per-function dml erase fixture here yield result finally: metadata.drop_all(config.db) return fixture_functions.fixture(scope=ddl)(run_ddl) return decorate def _safe_int(value: str) -> Union[int, str]: try: return int(value) except: return value def testing_engine(url=None, options=None, future=False): from sqlalchemy.testing import config from sqlalchemy.testing.engines import testing_engine if not future: future = getattr(config._current.options, "future_engine", False) if not sqla_2: kw = {"future": future} if future else {} else: kw = {} return testing_engine(url, options, **kw)
SILENT KILLER Tool