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
b79fc11d
Kaydet (Commit)
b79fc11d
authored
Agu 29, 2015
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Made the autoreloader survive all exceptions.
Refs #24704.
üst
fe6ddb83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
autoreload.py
django/utils/autoreload.py
+1
-2
test_autoreload.py
tests/utils_tests/test_autoreload.py
+16
-0
No files found.
django/utils/autoreload.py
Dosyayı görüntüle @
b79fc11d
...
...
@@ -224,8 +224,7 @@ def check_errors(fn):
global
_exception
try
:
fn
(
*
args
,
**
kwargs
)
except
(
ImportError
,
IndentationError
,
NameError
,
SyntaxError
,
TypeError
,
AttributeError
):
except
Exception
:
_exception
=
sys
.
exc_info
()
et
,
ev
,
tb
=
_exception
...
...
tests/utils_tests/test_autoreload.py
Dosyayı görüntüle @
b79fc11d
...
...
@@ -169,3 +169,19 @@ class TestFilenameGenerator(SimpleTestCase):
with
self
.
assertRaises
(
SyntaxError
):
autoreload
.
check_errors
(
import_module
)(
'test_syntax_error'
)
self
.
assertFileFoundOnlyNew
(
filename
)
def
test_check_errors_catches_all_exceptions
(
self
):
"""
Since Python may raise arbitrary exceptions when importing code,
check_errors() must catch Exception, not just some subclasses.
"""
dirname
=
tempfile
.
mkdtemp
()
filename
=
os
.
path
.
join
(
dirname
,
'test_exception.py'
)
self
.
addCleanup
(
shutil
.
rmtree
,
dirname
)
with
open
(
filename
,
'w'
)
as
f
:
f
.
write
(
"raise Exception"
)
with
extend_sys_path
(
dirname
):
with
self
.
assertRaises
(
Exception
):
autoreload
.
check_errors
(
import_module
)(
'test_exception'
)
self
.
assertFileFound
(
filename
)
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