def mark_exists():
    if get_db_engine() == 'postgresql_psycopg2':
        r = run_cmd('psql', TEST_DB_NAME, '-c', 'SELECT 1 FROM mark_table')

        # When something pops out on std_out, we are good
        return bool(r.std_out)

    if get_db_engine() == 'mysql':
        r = run_mysql(TEST_DB_NAME, '-e', 'SELECT 1 FROM mark_table')

        return r.status_code == 0

    if get_db_engine() == 'sqlite3':
        if TEST_DB_NAME == ':memory:':
            raise AssertionError(
                'sqlite in-memory database cannot be checked for mark!')

        conn = sqlite3.connect(TEST_DB_NAME)
        try:
            with conn:
                conn.execute('SELECT 1 FROM mark_table')
                return True
        except sqlite3.OperationalError:
            return False
        finally:  # Close the DB even if an error is raised
            conn.close()

    raise AssertionError('%s cannot be tested properly!' % get_db_engine())
dataset/ETHPy150Open pytest-dev/pytest-django/pytest_django_test/db_helpers.py/mark_exists/original