Exemplo n.º 1
0
 def t_sqlite_prepare_engine(self, db, tmp_path):
     result = Distro.get("sqlite")
     if db == "sqlite.db":
         db = tmp_path / "sqlite.db"
     url, _ = result.create_spec(server="srvr",
                                 database=db,
                                 engine_kwargs={})
     assert str(db or ":memory:") in url
Exemplo n.º 2
0
 def t_prepare_for_other_engines(self, test_distro):
     if test_distro == "sqlite":
         pytest.skip("sqlite handled elsewhere")
     try:
         result = Distro.get(test_distro)
     except ModuleNotFoundError:
         pytest.skip(f"Missing {test_distro} module.")
     url, _ = result.create_spec(server="srvr",
                                 database="db",
                                 engine_kwargs=KeyReturner)
     assert test_distro in url
Exemplo n.º 3
0
 def t_get_exactly_one_distro_canonically(self, test_distro):
     try:
         result = Distro.get(test_distro)
         assert test_distro.lower() == result.name.lower()
     except ModuleNotFoundError:
         pytest.skip(f"Missing {test_distro} module.")
Exemplo n.º 4
0
 def t_fail_vague_distros(self, vaguename):
     with pytest.raises(SQLDistroNotFound):
         Distro.get(vaguename)
Exemplo n.º 5
0
 def t_fail_bad_distros(self, badname):
     with pytest.raises(SQLDistroNotFound):
         Distro.get(badname)
Exemplo n.º 6
0
 def t_get_exactly_one_distro_variants(self, canonical, incoming,
                                       test_distro):
     if canonical != test_distro:
         pytest.skip("")
     assert Distro.get(incoming).name == canonical
     assert Distro.get(incoming.upper()).name == canonical