django アプリケーションのテストにセレンを使用しようとしています
次のコマンドを実行した後:
python3 manage.py test function_test(folder)
次のエラーが発生しました。
*Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/usr/local/lib/python3.4/dist-packages/django/db/backends/base/base.py", line 122, in connect
connection_created.send(sender=self.__class__, connection=self)
File "/usr/local/lib/python3.4/dist-packages/django/dispatch/dispatcher.py", line 189, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/local/lib/python3.4/dist-packages/django_hstore/apps.py", line 48, in __call__
return [x(connection) for x in handlers]
File "/usr/local/lib/python3.4/dist-packages/django_hstore/apps.py", line 48, in <listcomp>
return [x(connection) for x in handlers]
File "/usr/local/lib/python3.4/dist-packages/django_hstore/apps.py", line 76, in register_hstore_handler
register_hstore(connection.connection, globally=HSTORE_REGISTER_GLOBALLY)
File "/usr/local/lib/python3.4/dist-packages/psycopg2/extras.py", line 775, in register_hstore
"hstore type not found in the database. "
psycopg2.ProgrammingError: hstore type not found in the database. please install it from your 'contrib/hstore.sql' fil*e
メイン プロジェクトに既に hstore をインストールしており、 live_server_test_case でテストを実行しているため、問題は発生しないはずです。
setup() 関数での hstore タイプの作成について述べたように、セレン コードを実行する前に移行をスキップする方法はありますが、コードに到達できません。