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
ade98599
Kaydet (Commit)
ade98599
authored
Ock 07, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24095 -- Prevented WarningLoggerTests from leaking a warnings filter.
üst
862ea825
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
tests.py
tests/logging_tests/tests.py
+10
-7
No files found.
tests/logging_tests/tests.py
Dosyayı görüntüle @
ade98599
...
...
@@ -101,7 +101,6 @@ class WarningLoggerTests(TestCase):
# undocumented and (I assume) brittle.
self
.
_old_capture_state
=
bool
(
getattr
(
logging
,
'_warnings_showwarning'
,
False
))
logging
.
captureWarnings
(
True
)
warnings
.
filterwarnings
(
'always'
)
# this convoluted setup is to avoid printing this deprecation to
# stderr during test running - as the test runner forces deprecations
...
...
@@ -123,14 +122,18 @@ class WarningLoggerTests(TestCase):
@override_settings
(
DEBUG
=
True
)
def
test_warnings_capture
(
self
):
warnings
.
warn
(
'Foo Deprecated'
,
RemovedInNextVersionWarning
)
output
=
force_text
(
self
.
outputs
[
0
]
.
getvalue
())
self
.
assertIn
(
'Foo Deprecated'
,
output
)
with
warnings
.
catch_warnings
():
warnings
.
filterwarnings
(
'always'
)
warnings
.
warn
(
'Foo Deprecated'
,
RemovedInNextVersionWarning
)
output
=
force_text
(
self
.
outputs
[
0
]
.
getvalue
())
self
.
assertIn
(
'Foo Deprecated'
,
output
)
def
test_warnings_capture_debug_false
(
self
):
warnings
.
warn
(
'Foo Deprecated'
,
RemovedInNextVersionWarning
)
output
=
force_text
(
self
.
outputs
[
0
]
.
getvalue
())
self
.
assertNotIn
(
'Foo Deprecated'
,
output
)
with
warnings
.
catch_warnings
():
warnings
.
filterwarnings
(
'always'
)
warnings
.
warn
(
'Foo Deprecated'
,
RemovedInNextVersionWarning
)
output
=
force_text
(
self
.
outputs
[
0
]
.
getvalue
())
self
.
assertNotIn
(
'Foo Deprecated'
,
output
)
@override_settings
(
DEBUG
=
True
)
def
test_error_filter_still_raises
(
self
):
...
...
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