pytest-django

    1熱度

    1回答

    我使用Django (1.9.6),pytest (2.9.2)和pytest-django (2.9.1) 數據庫訪問我有一個數據遷移,看起來像這樣: # -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-07 09:56 from __future__ import unicode_literals from dj

    0熱度

    1回答

    我用許多應用程序構建了django項目。現在我想爲這些應用程序生成覆蓋率報告。出於測試目的,我使用py.test,pytest-django和pytest-cov。到目前爲止,我只能產生在命令行上手動輸入我的所有的應用程序名稱的報告: py.test --cov-report html --cov=app1 --cov=app2 --cov=app3 --cov=app4 */tests.py

    3熱度

    2回答

    我使用pytest 3.0.6和pytest-django 3.1.2在Django庫上工作。我有這個非常簡單的測試失敗了,我不明白髮生什麼: # test_mytest.py import pytest from django.contrib.auth.models import Permission from django.contrib.contenttypes.models impo

    0熱度

    1回答

    我有一個接收器,需要知道我的settings.py中的DEBUG是否設置爲True。 from django.conf import settings ... @receiver(post_save, sender=User) def create_fake_firebaseUID(sender, instance, created=False, **kwargs): # Fake

    1熱度

    3回答

    我有兩個方法的測試類,並且希望在兩個方法之間共享保存的模型實例。 我的燈具: @pytest.fixture(scope='class') def model_factory(): class ModelFactory(object): def get(self): x = Model(email='[email protected]',

    0熱度

    1回答

    嗨,我使用「http://pytest-ordering.readthedocs.org/en/develop/」,當我使用的裝飾如下順序工作正常上班, import pytest @pytest.mark.run(order=3) def test_three(): assert True @pytest.mark.run(order=1) def test_four():

    0熱度

    1回答

    我無法創建測試數據庫,因爲沒有找到數據庫而出現錯誤。我真的不知道什麼是錯的,爲什麼數據庫也沒有創造 pytest.ini [pytest] DJANGO_SETTINGS_MODULE=testing.test_settings addopts = --nomigrations --cov=. --cov-report=html test_settings.py from settings

    0熱度

    1回答

    添加夾具我是新來的Python和我在pytest test_client.py # Simple Example tests import pytest def test_one(): assert False == False def test_two(): assert True == True def cleanup(): # do some c

    0熱度

    1回答

    @pytest.mark.django_db class TestClass(): def do_setup(self): # do setup def test_a(self): # do something def test_b(self): # do something 在test_a和test_b測試用例運行之前

    0熱度

    1回答

    我使用pytest與pytest-django和pytest-cov插件測試Django項目,當我告訴它在目錄中尋找測試時(pytest project -vv --cov --ds=proj.tests),它不會重寫Asse田,當它發生: def test_pytest(): > assert 2 == 3 E AssertionError 然而,它仍然總是在另一個目錄/ Djang