Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
cdee8659
Kaydet (Commit)
cdee8659
authored
Kas 15, 2014
tarafından
Danilo Bargen
Kaydeden (comit)
Tim Graham
Kas 24, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23543 -- Added docs on testing management command output.
üst
94e2d391
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
custom-management-commands.txt
docs/howto/custom-management-commands.txt
+6
-0
tools.txt
docs/topics/testing/tools.txt
+19
-0
No files found.
docs/howto/custom-management-commands.txt
Dosyayı görüntüle @
cdee8659
...
...
@@ -193,6 +193,12 @@ non-uniform locales, so you might need to:
differences when locales are changed and evaluate its impact on
predictable behavior of your command.
Testing
=======
Information on how to test custom management commands can be found in the
:ref:`testing docs <topics-testing-management-commands>`.
Command objects
===============
...
...
docs/topics/testing/tools.txt
Dosyayı görüntüle @
cdee8659
...
...
@@ -1623,6 +1623,25 @@ manually, assign the empty list to ``mail.outbox``::
# Empty the test outbox
mail.outbox = []
.. _topics-testing-management-commands:
Management Commands
-------------------
Management commands can be tested with the
:func:`~django.core.management.call_command` function. The output can be
redirected into a ``StringIO`` instance::
from django.core.management import call_command
from django.test import TestCase
from django.utils.six import StringIO
class ClosepollTest(TestCase):
def test_command_output(self):
out = StringIO()
call_command('closepoll', stdout=out)
self.assertIn('Expected output', out.getvalue())
.. _skipping-tests:
Skipping tests
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment