SORU
3 Mayıs 2011, Salı


Çalışan uygulama testleri bir dizin varsa Django belirli bir test çalışması

Django belgeleri (**15) belirterek tek tek test çalışmaları çalıştırabilirsiniz diyor ki:

$ ./manage.py test animals.AnimalTestCase

Bu Django uygulamanızın tests.py bir dosya testlerinizi olduğunu varsayar. Eğer bu doğruysa, o zaman bu komut beklendiği gibi çalışır.

Testleri bir dizin Django uygulaması için benim sınavım var:

my_project/apps/my_app/
├── __init__.py
├── tests
│   ├── __init__.py
│   ├── field_tests.py
│   ├── storage_tests.py
├── urls.py
├── utils.py
└── views.py

tests/__init__.py dosya süit() fonksiyonu:

import unittest

from my_project.apps.my_app.tests import field_tests, storage_tests

def suite():
    tests_loader = unittest.TestLoader().loadTestsFromModule
    test_suites = []
    test_suites.append(tests_loader(field_tests))
    test_suites.append(tests_loader(storage_tests))
    return unittest.TestSuite(test_suites)

Yaptığım testler için:

$ ./manage.py test my_app

Bireysel bir test durumu belirlemek için çalışan bir özel durum oluşturur:

$ ./manage.py test my_app.tests.storage_tests.StorageTestCase
...
ValueError: Test label 'my_app.tests.storage_tests.StorageTestCase' should be of the form app.TestCase or app.TestCase.test_method

Özel durum iletisi dediğini yapmaya çalıştım:

$ ./manage.py test my_app.StorageTestCase
...
ValueError: Test label 'my_app.StorageTestCase' does not refer to a test

Nasıl benim testler birden fazla dosya olduğunda tek tek test durumu belirtmek musunuz?

CEVAP
3 Mayıs 2011, Salı


Çıkış 16**. Senin gibi çalıştırmak için test belirlemek için izin verir:

python manage.py test another.test:TestCase.test_method

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Lancome USA

    Lancome USA

    30 HAZİRAN 2009
  • Phymec

    Phymec

    18 Temmuz 2009
  • TecNoob

    TecNoob

    15 AĞUSTOS 2013