(options, file_config)
| 422 | |
| 423 | @post |
| 424 | def _engine_uri(options, file_config): |
| 425 | from sqlalchemy import testing |
| 426 | from sqlalchemy.testing import config |
| 427 | from sqlalchemy.testing import provision |
| 428 | from sqlalchemy.engine import url as sa_url |
| 429 | |
| 430 | if options.dburi: |
| 431 | db_urls = list(options.dburi) |
| 432 | else: |
| 433 | db_urls = [] |
| 434 | |
| 435 | extra_drivers = options.dbdriver or [] |
| 436 | |
| 437 | if options.db: |
| 438 | for db_token in options.db: |
| 439 | for db in re.split(r"[,\s]+", db_token): |
| 440 | if db not in file_config.options("db"): |
| 441 | raise RuntimeError( |
| 442 | "Unknown URI specifier '%s'. " |
| 443 | "Specify --dbs for known uris." % db |
| 444 | ) |
| 445 | else: |
| 446 | db_urls.append(file_config.get("db", db)) |
| 447 | |
| 448 | if not db_urls: |
| 449 | db_urls.append(file_config.get("db", "default")) |
| 450 | |
| 451 | config._current = None |
| 452 | |
| 453 | if options.write_idents and provision.FOLLOWER_IDENT: |
| 454 | for db_url in [sa_url.make_url(db_url) for db_url in db_urls]: |
| 455 | with open(options.write_idents, "a") as file_: |
| 456 | file_.write( |
| 457 | f"{provision.FOLLOWER_IDENT} " |
| 458 | f"{db_url.render_as_string(hide_password=False)}\n" |
| 459 | ) |
| 460 | |
| 461 | expanded_urls = list(provision.generate_db_urls(db_urls, extra_drivers)) |
| 462 | |
| 463 | for db_url in expanded_urls: |
| 464 | log.info("Adding database URL: %s", db_url) |
| 465 | |
| 466 | cfg = provision.setup_config( |
| 467 | db_url, options, file_config, provision.FOLLOWER_IDENT |
| 468 | ) |
| 469 | if not config._current: |
| 470 | cfg.set_as_current(cfg, testing) |
| 471 | |
| 472 | |
| 473 | @post |
nothing calls this directly
no test coverage detected