Python Django的整齐格式化测试用例错误输出

时间:2017-05-29 06:45:02

标签: python django

我正在使用

运行我的django应用程序的鼻子测试用例
python manage.py test

但是,当我得到输出特定的测试用例错误时,输出如下:

>         Error Message
>     exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/home/ubuntu/Envs/venv/local/lib/python2.7/site-packages/django/db/backends/util.py",
> line 53, in execute return self.cursor.execute(sql, params) File
> "/home/ubuntu/Envs/venv/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py",
> line 452, in execute return Database.Cursor.execute(self, query,
> params) 'UNIQUE constraint failed: apixyz_.budsadsinesds_id,
> api_user_id\n-------------------- >> begin captured logging <<
> --------------------\npy.warnings: WARNING: /home/ubuntu/Envs/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:883:
> RuntimeWarning: DateTimeField BusinessMetrics.from_date received
> a naive datetime (2017-05-29 11:35:13.639105) while time zone support
> is active.\n RuntimeWarning)\n\npy.warnings: WARNING:
> /home/ubuntu/Envs/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:883:
> RuntimeWarning: DateTimeMetrics.from_date received a naive datetime
> (2017-05-29 11:35:13.647704) while time zone support is active.\n
> RuntimeWarning)\n\npy.warnings: WARNING:
> /home/ubuntu/Envs/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:883:
> RuntimeWarning: DateTimeMetrics.from_date received a naive datetime
> (2017-05-29 11:35:13.656736) while time zone support is active.\n

(在这里粘贴一个样本,但它看起来更好,因为我将这些行添加为引号和代码块)

这不是真的可读。我可以设置一些选项,以便回溯更具可读性,并且\ n会自动更改为下一行吗?

0 个答案:

没有答案