code: def test_error_on_passing_engine(self):
      env = self._fixture()
  
      engine = _sqlite_file_db()
  
      a_rev = "arev"
      env.script.generate_revision(a_rev, "revision a", refresh=True)
      write_script(
          env.script,
          a_rev,
          """\
  "Rev A"
  revision = '%s'
  down_revision = None
  
  from alembic import op
  
  
  def upgrade():
      pass
  
  
  def downgrade():
      pass
  
  """
          % a_rev,
      )
      migration_fn = mock.MagicMock()
  
      def upgrade(rev, context):
          migration_fn(rev, context)
          return env.script._upgrade_revs(a_rev, rev)
  
      with expect_raises_message(
          util.CommandError,
          r"'connection' argument to configure\(\) is "
          r"expected to be a sqlalchemy.engine.Connection ",
      ):
          env.configure(
              connection=engine, fn=upgrade, transactional_ddl=False
          )
  
imports: import os
  import sys
  from alembic import command
  from alembic import testing
  from alembic import util
  from alembic.environment import EnvironmentContext
  from alembic.migration import MigrationContext
  from alembic.script import ScriptDirectory
  from alembic.testing import config
  from alembic.testing import eq_
  from alembic.testing import is_
  from alembic.testing import mock
  from alembic.testing.assertions import expect_raises_message
  from alembic.testing.env import _get_staging_directory
  from alembic.testing.env import _no_sql_testing_config
  from alembic.testing.env import _sqlite_file_db
  from alembic.testing.env import _sqlite_testing_config
  from alembic.testing.env import clear_staging_env
  from alembic.testing.env import staging_env
  from alembic.testing.env import write_script
  from alembic.testing.fixtures import capture_context_buffer
  from alembic.testing.fixtures import TestBase
label_desc: Use image node_id 12 for calling the EnvironmentTest obj's underlying member method code with example usage: obj.test_error_on_passing_engine() and returns: env