Issue: Test failures in 2.7.3
Author: felixonmars
State: closed
Created: 2015-11-22 02:04:51

Hi, I am getting the following failures in 2.7.3, and they are not present in previous versions:

```
======================================================================
ERROR: test_children (playhouse.tests.test_sqlite_ext.TestJSONField)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such table: json_each

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/playhouse/tests/test_sqlite_ext.py", line 328, in test_children
    self.assertEqual([row for row, in query], [
  File "/build/python-peewee/src/peewee/peewee.py", line 2866, in __iter__
    return iter(self.execute())
  File "/build/python-peewee/src/peewee/peewee.py", line 2859, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "/build/python-peewee/src/peewee/peewee.py", line 2555, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/build/python-peewee/src/peewee/peewee.py", line 3366, in execute_sql
    self.commit()
  File "/build/python-peewee/src/peewee/peewee.py", line 3212, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/build/python-peewee/src/peewee/peewee.py", line 125, in reraise
    raise value.with_traceback(tb)
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such table: json_each

======================================================================
ERROR: test_extract (playhouse.tests.test_sqlite_ext.TestJSONField)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such function: json_extract

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/playhouse/tests/test_sqlite_ext.py", line 197, in test_extract
    self.assertEqual([row for row, in titles], [
  File "/build/python-peewee/src/peewee/peewee.py", line 2866, in __iter__
    return iter(self.execute())
  File "/build/python-peewee/src/peewee/peewee.py", line 2859, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "/build/python-peewee/src/peewee/peewee.py", line 2555, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/build/python-peewee/src/peewee/peewee.py", line 3366, in execute_sql
    self.commit()
  File "/build/python-peewee/src/peewee/peewee.py", line 3212, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/build/python-peewee/src/peewee/peewee.py", line 125, in reraise
    raise value.with_traceback(tb)
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such function: json_extract

======================================================================
ERROR: test_length (playhouse.tests.test_sqlite_ext.TestJSONField)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such function: json_array_length

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/playhouse/tests/test_sqlite_ext.py", line 223, in test_length
    self.assertEqual(list(tag_len), [
  File "/build/python-peewee/src/peewee/peewee.py", line 2866, in __iter__
    return iter(self.execute())
  File "/build/python-peewee/src/peewee/peewee.py", line 2859, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "/build/python-peewee/src/peewee/peewee.py", line 2555, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/build/python-peewee/src/peewee/peewee.py", line 3366, in execute_sql
    self.commit()
  File "/build/python-peewee/src/peewee/peewee.py", line 3212, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/build/python-peewee/src/peewee/peewee.py", line 125, in reraise
    raise value.with_traceback(tb)
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such function: json_array_length

======================================================================
ERROR: test_multi_set (playhouse.tests.test_sqlite_ext.TestJSONField)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such function: json_set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/playhouse/tests/test_sqlite_ext.py", line 305, in test_multi_set
    .where(APIData.value.contains('LSM Storage'))
  File "/build/python-peewee/src/peewee/peewee.py", line 3013, in execute
    return self.database.rows_affected(self._execute())
  File "/build/python-peewee/src/peewee/peewee.py", line 2555, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/build/python-peewee/src/peewee/peewee.py", line 3366, in execute_sql
    self.commit()
  File "/build/python-peewee/src/peewee/peewee.py", line 3212, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/build/python-peewee/src/peewee/peewee.py", line 125, in reraise
    raise value.with_traceback(tb)
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such function: json_set

======================================================================
ERROR: test_remove (playhouse.tests.test_sqlite_ext.TestJSONField)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such function: json_remove

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/playhouse/tests/test_sqlite_ext.py", line 238, in test_remove
    self.assertEqual([row for row, in query], ['{}'] * 5)
  File "/build/python-peewee/src/peewee/peewee.py", line 2866, in __iter__
    return iter(self.execute())
  File "/build/python-peewee/src/peewee/peewee.py", line 2859, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "/build/python-peewee/src/peewee/peewee.py", line 2555, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/build/python-peewee/src/peewee/peewee.py", line 3366, in execute_sql
    self.commit()
  File "/build/python-peewee/src/peewee/peewee.py", line 3212, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/build/python-peewee/src/peewee/peewee.py", line 125, in reraise
    raise value.with_traceback(tb)
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such function: json_remove

======================================================================
ERROR: test_set (playhouse.tests.test_sqlite_ext.TestJSONField)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such function: json_set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/python-peewee/src/peewee/playhouse/tests/test_sqlite_ext.py", line 273, in test_set
    [json.loads(row) for row, in query],
  File "/build/python-peewee/src/peewee/peewee.py", line 2866, in __iter__
    return iter(self.execute())
  File "/build/python-peewee/src/peewee/peewee.py", line 2859, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "/build/python-peewee/src/peewee/peewee.py", line 2555, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/build/python-peewee/src/peewee/peewee.py", line 3366, in execute_sql
    self.commit()
  File "/build/python-peewee/src/peewee/peewee.py", line 3212, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/build/python-peewee/src/peewee/peewee.py", line 125, in reraise
    raise value.with_traceback(tb)
  File "/build/python-peewee/src/peewee/peewee.py", line 3359, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such function: json_set

----------------------------------------------------------------------
Ran 496 tests in 526.219s

FAILED (errors=6)
```


Looks like you're missing the JSON1 extension. I'll add a conditional.