[英]Django App Tests Won't Run Specifically (But Will Run With All Tests)
[英]Can't run django tests by tag
我有問題,因為我想在 django 中標記一些測試,但是當我輸入控制台時
from django.test import tag, TestCase
@tag('fast', 'something')
class SomeTestCase(TestCase):
def setUp(self):
# do something
def test_something(self):
# do something
當我在控制台中輸入時:
./manage.py test --tag=fast -k
我得到:
Using existing test database for alias 'default'...
System check identified no issues (0 silenced).
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
Preserving test database for alias 'default'...
示例模塊結構:
├── admin.py
├── __init__.py
├── migrations
├── models.py
├── tests
│ ├── __init__.py
│ ├── tests.py
│ └── test_views.py
├── urls.py
└── views.py
檢查測試文件中是否存在語法錯誤或錯誤導入。 我有一個錯誤的導入,它Ran 0 tests in 0.000s
了Ran 0 tests in 0.000s
而默默地失敗了。
檢查您是否更改了TEST_RUNNER
中的TEST_RUNNER
我們沒有安裝django-nose 。 我沒有意識到我們沒有使用默認的測試運行器,並花了很長時間試圖找出我的標簽不起作用的原因。 這個帖子一直在我搜索的時候出現。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.