# Path: spanner_orm/testlib/spanner_emulator/emulator.py
# _EMULATOR_BINARY_PATH_ENV_VAR = "SPANNER_EMULATOR_BINARY_PATH"
# _CLIENT_EMULATOR_ENV_VAR = "SPANNER_EMULATOR_HOST"
# class Emulator:
#   def __init__(self,
#                *,
#                spanner_emulator_port: Optional[int] = None,
#                log_emulator_requests: bool = False) -> None:
#   def get_client(
#       self,
#       project: str = "test-project",
#       client_options: Optional[Mapping[str, str]] = None) -> client.Client:
#   def _start(self) -> None:
#   def _wait_for_ready(self) -> None:
#   def stop(self) -> None:


import os
import unittest
import uuid
import spanner_orm
from google.cloud.spanner_v1 import client
from google.cloud.spanner_v1 import database
from google.cloud.spanner_v1 import instance
from spanner_orm.testlib.spanner_emulator import emulator
  """Applies the migrations to the provided connection."""
  spanner_orm.from_connection(connection)
  executor = spanner_orm.MigrationExecutor(connection, basedir=migrations_dir)
  executor.migrate()


def _database_id() -> str:
  """Returns a new database ID that's unlikely to conflict with any other."""
  random_string = str(uuid.uuid4()).split('-')[0]
  return 'spanner-db-' + random_string


class TestCase(unittest.TestCase):
  """Sets up a spanner emulator database for each test case.

  Any test class that subclasses this class will have a spanner database
  setup for it. That database is empty by default; most subclasses will want to
  call run_orm_migrations() in their setUp() method.

  Attributes:
    spanner_emulator_client: Client, for use by non-ORM tests.
    spanner_emulator_instance: Instance, for use by non-ORM tests.
    spanner_emulator_database: Database, for use by non-ORM tests.
  """

  _spanner_emulator: emulator.Emulator

  @classmethod
  def setUpClass(cls):
    super().setUpClass()

# Path: spanner_orm/testlib/spanner_emulator/emulator.py
# _EMULATOR_BINARY_PATH_ENV_VAR = "SPANNER_EMULATOR_BINARY_PATH"
# _CLIENT_EMULATOR_ENV_VAR = "SPANNER_EMULATOR_HOST"
# class Emulator:
#   def __init__(self,
#                *,
#                spanner_emulator_port: Optional[int] = None,
#                log_emulator_requests: bool = False) -> None:
#   def get_client(
#       self,
#       project: str = "test-project",
#       client_options: Optional[Mapping[str, str]] = None) -> client.Client:
#   def _start(self) -> None:
#   def _wait_for_ready(self) -> None:
#   def stop(self) -> None:


# Path: spanner_orm/testlib/spanner_emulator/testlib.py
import os
import unittest
import uuid
import spanner_orm
from google.cloud.spanner_v1 import client
from google.cloud.spanner_v1 import database
from google.cloud.spanner_v1 import instance
from spanner_orm.testlib.spanner_emulator import emulator

  """Applies the migrations to the provided connection."""
  spanner_orm.from_connection(connection)
  executor = spanner_orm.MigrationExecutor(connection, basedir=migrations_dir)
  executor.migrate()


def _database_id() -> str:
  """Returns a new database ID that's unlikely to conflict with any other."""
  random_string = str(uuid.uuid4()).split('-')[0]
  return 'spanner-db-' + random_string


class TestCase(unittest.TestCase):
  """Sets up a spanner emulator database for each test case.

  Any test class that subclasses this class will have a spanner database
  setup for it. That database is empty by default; most subclasses will want to
  call run_orm_migrations() in their setUp() method.

  Attributes:
    spanner_emulator_client: Client, for use by non-ORM tests.
    spanner_emulator_instance: Instance, for use by non-ORM tests.
    spanner_emulator_database: Database, for use by non-ORM tests.
  """

  _spanner_emulator: emulator.Emulator

  @classmethod
  def setUpClass(cls):
    super().setUpClass()

    cls._spanner_emulator = emulator.Emulator()