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
109b33f6
Kaydet (Commit)
109b33f6
authored
Ock 20, 2017
tarafından
Tim Graham
Kaydeden (comit)
Aymeric Augustin
Ock 20, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #23919 -- Simplified assertRaisesRegex()'s that accounted for Python 2.
üst
dc8834ca
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
43 additions
and
42 deletions
+43
-42
test_hashers.py
tests/auth_tests/test_hashers.py
+11
-7
tests.py
tests/file_storage/tests.py
+2
-3
tests.py
tests/fixtures_regress/tests.py
+1
-1
test_regexfield.py
tests/forms_tests/field_tests/test_regexfield.py
+3
-3
test_splitdatetimefield.py
tests/forms_tests/field_tests/test_splitdatetimefield.py
+2
-2
test_forms.py
tests/forms_tests/tests/test_forms.py
+3
-5
test_writer.py
tests/migrations/test_writer.py
+1
-1
test_utils.py
tests/template_backends/test_utils.py
+2
-2
test_custom.py
tests/template_tests/test_custom.py
+6
-10
test_parser.py
tests/template_tests/test_parser.py
+1
-1
tests.py
tests/test_utils/tests.py
+9
-5
test_module_loading.py
tests/utils_tests/test_module_loading.py
+2
-2
No files found.
tests/auth_tests/test_hashers.py
Dosyayı görüntüle @
109b33f6
...
@@ -251,7 +251,7 @@ class TestUtilsHashPass(SimpleTestCase):
...
@@ -251,7 +251,7 @@ class TestUtilsHashPass(SimpleTestCase):
self
.
assertFalse
(
check_password
(
''
,
encoded
))
self
.
assertFalse
(
check_password
(
''
,
encoded
))
self
.
assertFalse
(
check_password
(
'lètmein'
,
encoded
))
self
.
assertFalse
(
check_password
(
'lètmein'
,
encoded
))
self
.
assertFalse
(
check_password
(
'lètmeinz'
,
encoded
))
self
.
assertFalse
(
check_password
(
'lètmeinz'
,
encoded
))
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
Message
(
ValueError
,
'Unknown password hashing algorith'
):
identify_hasher
(
encoded
)
identify_hasher
(
encoded
)
# Assert that the unusable passwords actually contain a random part.
# Assert that the unusable passwords actually contain a random part.
# This might fail one day due to a hash collision.
# This might fail one day due to a hash collision.
...
@@ -265,9 +265,13 @@ class TestUtilsHashPass(SimpleTestCase):
...
@@ -265,9 +265,13 @@ class TestUtilsHashPass(SimpleTestCase):
self
.
assertFalse
(
check_password
(
None
,
make_password
(
'lètmein'
)))
self
.
assertFalse
(
check_password
(
None
,
make_password
(
'lètmein'
)))
def
test_bad_algorithm
(
self
):
def
test_bad_algorithm
(
self
):
with
self
.
assertRaises
(
ValueError
):
msg
=
(
"Unknown password hashing algorithm '
%
s'. Did you specify it in "
"the PASSWORD_HASHERS setting?"
)
with
self
.
assertRaisesMessage
(
ValueError
,
msg
%
'lolcat'
):
make_password
(
'lètmein'
,
hasher
=
'lolcat'
)
make_password
(
'lètmein'
,
hasher
=
'lolcat'
)
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
Message
(
ValueError
,
msg
%
'lolcat'
):
identify_hasher
(
'lolcat$salt$hash'
)
identify_hasher
(
'lolcat$salt$hash'
)
def
test_bad_encoded
(
self
):
def
test_bad_encoded
(
self
):
...
@@ -424,15 +428,15 @@ class TestUtilsHashPass(SimpleTestCase):
...
@@ -424,15 +428,15 @@ class TestUtilsHashPass(SimpleTestCase):
self
.
assertEqual
(
hasher
.
harden_runtime
.
call_count
,
1
)
self
.
assertEqual
(
hasher
.
harden_runtime
.
call_count
,
1
)
def
test_load_library_no_algorithm
(
self
):
def
test_load_library_no_algorithm
(
self
):
with
self
.
assertRaises
(
ValueError
)
as
e
:
msg
=
"Hasher 'BasePasswordHasher' doesn't specify a library attribute"
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
BasePasswordHasher
()
.
_load_library
()
BasePasswordHasher
()
.
_load_library
()
self
.
assertEqual
(
"Hasher 'BasePasswordHasher' doesn't specify a library attribute"
,
str
(
e
.
exception
))
def
test_load_library_importerror
(
self
):
def
test_load_library_importerror
(
self
):
PlainHasher
=
type
(
'PlainHasher'
,
(
BasePasswordHasher
,),
{
'algorithm'
:
'plain'
,
'library'
:
'plain'
})
PlainHasher
=
type
(
'PlainHasher'
,
(
BasePasswordHasher
,),
{
'algorithm'
:
'plain'
,
'library'
:
'plain'
})
# Python 3 adds quotes around module name
# Python 3 adds quotes around module name
msg
=
"Couldn't load 'PlainHasher' algorithm library: No module named '
?plain'?
"
msg
=
"Couldn't load 'PlainHasher' algorithm library: No module named '
plain'
"
with
self
.
assertRaises
Regex
(
ValueError
,
msg
):
with
self
.
assertRaises
Message
(
ValueError
,
msg
):
PlainHasher
()
.
_load_library
()
PlainHasher
()
.
_load_library
()
...
...
tests/file_storage/tests.py
Dosyayı görüntüle @
109b33f6
...
@@ -45,7 +45,7 @@ class GetStorageClassTests(SimpleTestCase):
...
@@ -45,7 +45,7 @@ class GetStorageClassTests(SimpleTestCase):
"""
"""
get_storage_class raises an error if the requested import don't exist.
get_storage_class raises an error if the requested import don't exist.
"""
"""
with
self
.
assertRaises
Regex
(
ImportError
,
"No module named '?storage'?
"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named 'storage'
"
):
get_storage_class
(
'storage.NonExistingStorage'
)
get_storage_class
(
'storage.NonExistingStorage'
)
def
test_get_nonexisting_storage_class
(
self
):
def
test_get_nonexisting_storage_class
(
self
):
...
@@ -59,8 +59,7 @@ class GetStorageClassTests(SimpleTestCase):
...
@@ -59,8 +59,7 @@ class GetStorageClassTests(SimpleTestCase):
"""
"""
get_storage_class raises an error if the requested module don't exist.
get_storage_class raises an error if the requested module don't exist.
"""
"""
# Error message may or may not be the fully qualified path.
with
self
.
assertRaisesMessage
(
ImportError
,
"No module named 'django.core.files.non_existing_storage'"
):
with
self
.
assertRaisesRegex
(
ImportError
,
"No module named '?(django.core.files.)?non_existing_storage'?"
):
get_storage_class
(
'django.core.files.non_existing_storage.NonExistingStorage'
)
get_storage_class
(
'django.core.files.non_existing_storage.NonExistingStorage'
)
...
...
tests/fixtures_regress/tests.py
Dosyayı görüntüle @
109b33f6
...
@@ -197,7 +197,7 @@ class TestFixtures(TestCase):
...
@@ -197,7 +197,7 @@ class TestFixtures(TestCase):
"""
"""
Failing serializer import raises the proper error
Failing serializer import raises the proper error
"""
"""
with
self
.
assertRaises
Regex
(
ImportError
,
r"No module named.*unexistent
"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named 'unexistent'
"
):
management
.
call_command
(
management
.
call_command
(
'loaddata'
,
'loaddata'
,
'bad_fixture1.unkn'
,
'bad_fixture1.unkn'
,
...
...
tests/forms_tests/field_tests/test_regexfield.py
Dosyayı görüntüle @
109b33f6
...
@@ -42,10 +42,10 @@ class RegexFieldTest(SimpleTestCase):
...
@@ -42,10 +42,10 @@ class RegexFieldTest(SimpleTestCase):
f
=
RegexField
(
'^[0-9]+$'
,
min_length
=
5
,
max_length
=
10
)
f
=
RegexField
(
'^[0-9]+$'
,
min_length
=
5
,
max_length
=
10
)
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Ensure this value has at least 5 characters (it has 3).'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Ensure this value has at least 5 characters (it has 3).'"
):
f
.
clean
(
'123'
)
f
.
clean
(
'123'
)
with
self
.
assertRaises
Regex
(
with
self
.
assertRaises
Message
(
ValidationError
,
ValidationError
,
r"'Ensure this value has at least 5 characters \(it has 3\)\.',
"
"'Ensure this value has at least 5 characters (it has 3).',
"
r" u?'Enter a valid value\
.'"
,
"'Enter a valid value
.'"
,
):
):
f
.
clean
(
'abc'
)
f
.
clean
(
'abc'
)
self
.
assertEqual
(
'12345'
,
f
.
clean
(
'12345'
))
self
.
assertEqual
(
'12345'
,
f
.
clean
(
'12345'
))
...
...
tests/forms_tests/field_tests/test_splitdatetimefield.py
Dosyayı görüntüle @
109b33f6
...
@@ -20,7 +20,7 @@ class SplitDateTimeFieldTest(SimpleTestCase):
...
@@ -20,7 +20,7 @@ class SplitDateTimeFieldTest(SimpleTestCase):
f
.
clean
(
''
)
f
.
clean
(
''
)
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a list of values.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a list of values.'"
):
f
.
clean
(
'hello'
)
f
.
clean
(
'hello'
)
with
self
.
assertRaises
Regex
(
ValidationError
,
r"'Enter a valid date\.', u?'Enter a valid time\
.'"
):
with
self
.
assertRaises
Message
(
ValidationError
,
"'Enter a valid date.', 'Enter a valid time
.'"
):
f
.
clean
([
'hello'
,
'there'
])
f
.
clean
([
'hello'
,
'there'
])
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid time.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid time.'"
):
f
.
clean
([
'2006-01-10'
,
'there'
])
f
.
clean
([
'2006-01-10'
,
'there'
])
...
@@ -40,7 +40,7 @@ class SplitDateTimeFieldTest(SimpleTestCase):
...
@@ -40,7 +40,7 @@ class SplitDateTimeFieldTest(SimpleTestCase):
self
.
assertIsNone
(
f
.
clean
([
''
,
''
]))
self
.
assertIsNone
(
f
.
clean
([
''
,
''
]))
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a list of values.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a list of values.'"
):
f
.
clean
(
'hello'
)
f
.
clean
(
'hello'
)
with
self
.
assertRaises
Regex
(
ValidationError
,
r"'Enter a valid date\.', u?'Enter a valid time\
.'"
):
with
self
.
assertRaises
Message
(
ValidationError
,
"'Enter a valid date.', 'Enter a valid time
.'"
):
f
.
clean
([
'hello'
,
'there'
])
f
.
clean
([
'hello'
,
'there'
])
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid time.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid time.'"
):
f
.
clean
([
'2006-01-10'
,
'there'
])
f
.
clean
([
'2006-01-10'
,
'there'
])
...
...
tests/forms_tests/tests/test_forms.py
Dosyayı görüntüle @
109b33f6
...
@@ -2954,10 +2954,8 @@ Good luck picking a username that doesn't already exist.</p>
...
@@ -2954,10 +2954,8 @@ Good luck picking a username that doesn't already exist.</p>
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a complete value.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a complete value.'"
):
f
.
clean
([
'+61'
])
f
.
clean
([
'+61'
])
self
.
assertEqual
(
'+61.287654321 ext. 123 (label: )'
,
f
.
clean
([
'+61'
,
'287654321'
,
'123'
]))
self
.
assertEqual
(
'+61.287654321 ext. 123 (label: )'
,
f
.
clean
([
'+61'
,
'287654321'
,
'123'
]))
self
.
assertRaisesRegex
(
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a complete value.', 'Enter an extension.'"
):
ValidationError
,
f
.
clean
([
''
,
''
,
''
,
'Home'
])
r"'Enter a complete value\.', u?'Enter an extension\.'"
,
f
.
clean
,
[
''
,
''
,
''
,
'Home'
]
)
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid country code.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid country code.'"
):
f
.
clean
([
'61'
,
'287654321'
,
'123'
,
'Home'
])
f
.
clean
([
'61'
,
'287654321'
,
'123'
,
'Home'
])
...
@@ -2970,7 +2968,7 @@ Good luck picking a username that doesn't already exist.</p>
...
@@ -2970,7 +2968,7 @@ Good luck picking a username that doesn't already exist.</p>
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a complete value.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a complete value.'"
):
f
.
clean
([
'+61'
])
f
.
clean
([
'+61'
])
self
.
assertEqual
(
'+61.287654321 ext. 123 (label: )'
,
f
.
clean
([
'+61'
,
'287654321'
,
'123'
]))
self
.
assertEqual
(
'+61.287654321 ext. 123 (label: )'
,
f
.
clean
([
'+61'
,
'287654321'
,
'123'
]))
with
self
.
assertRaises
Regex
(
ValidationError
,
r"'Enter a complete value\.', u?'Enter an extension\
.'"
):
with
self
.
assertRaises
Message
(
ValidationError
,
"'Enter a complete value.', 'Enter an extension
.'"
):
f
.
clean
([
''
,
''
,
''
,
'Home'
])
f
.
clean
([
''
,
''
,
''
,
'Home'
])
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid country code.'"
):
with
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a valid country code.'"
):
f
.
clean
([
'61'
,
'287654321'
,
'123'
,
'Home'
])
f
.
clean
([
'61'
,
'287654321'
,
'123'
,
'Home'
])
...
...
tests/migrations/test_writer.py
Dosyayı görüntüle @
109b33f6
...
@@ -450,7 +450,7 @@ class WriterTests(SimpleTestCase):
...
@@ -450,7 +450,7 @@ class WriterTests(SimpleTestCase):
self
.
assertEqual
(
string
,
"migrations.test_writer.EmailValidator(message='hello')"
)
self
.
assertEqual
(
string
,
"migrations.test_writer.EmailValidator(message='hello')"
)
validator
=
deconstructible
(
path
=
"custom.EmailValidator"
)(
EmailValidator
)(
message
=
"hello"
)
validator
=
deconstructible
(
path
=
"custom.EmailValidator"
)(
EmailValidator
)(
message
=
"hello"
)
with
self
.
assertRaises
Regex
(
ImportError
,
"No module named '?custom'?
"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named 'custom'
"
):
MigrationWriter
.
serialize
(
validator
)
MigrationWriter
.
serialize
(
validator
)
validator
=
deconstructible
(
path
=
"django.core.validators.EmailValidator2"
)(
EmailValidator
)(
message
=
"hello"
)
validator
=
deconstructible
(
path
=
"django.core.validators.EmailValidator2"
)(
EmailValidator
)(
message
=
"hello"
)
...
...
tests/template_backends/test_utils.py
Dosyayı görüntüle @
109b33f6
...
@@ -11,9 +11,9 @@ class TemplateUtilsTests(SimpleTestCase):
...
@@ -11,9 +11,9 @@ class TemplateUtilsTests(SimpleTestCase):
Failing to import a backend keeps raising the original import error
Failing to import a backend keeps raising the original import error
(#24265).
(#24265).
"""
"""
with
self
.
assertRaises
Regex
(
ImportError
,
"No module named '?
raise"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named '
raise"
):
engines
.
all
()
engines
.
all
()
with
self
.
assertRaises
Regex
(
ImportError
,
"No module named '?
raise"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named '
raise"
):
engines
.
all
()
engines
.
all
()
@override_settings
(
TEMPLATES
=
[{
@override_settings
(
TEMPLATES
=
[{
...
...
tests/template_tests/test_custom.py
Dosyayı görüntüle @
109b33f6
...
@@ -313,25 +313,21 @@ class TemplateTagLoadingTests(SimpleTestCase):
...
@@ -313,25 +313,21 @@ class TemplateTagLoadingTests(SimpleTestCase):
msg
=
(
msg
=
(
"Invalid template library specified. ImportError raised when "
"Invalid template library specified. ImportError raised when "
"trying to load 'template_tests.broken_tag': cannot import name "
"trying to load 'template_tests.broken_tag': cannot import name "
"'
?Xtemplate'?
"
"'
Xtemplate'
"
)
)
with
self
.
assertRaisesRegex
(
InvalidTemplateLibrary
,
msg
):
with
self
.
assertRaisesMessage
(
InvalidTemplateLibrary
,
msg
):
Engine
(
libraries
=
{
Engine
(
libraries
=
{
'broken_tag'
:
'template_tests.broken_tag'
})
'broken_tag'
:
'template_tests.broken_tag'
,
})
def
test_load_error_egg
(
self
):
def
test_load_error_egg
(
self
):
egg_name
=
'
%
s/tagsegg.egg'
%
self
.
egg_dir
egg_name
=
'
%
s/tagsegg.egg'
%
self
.
egg_dir
msg
=
(
msg
=
(
"Invalid template library specified. ImportError raised when "
"Invalid template library specified. ImportError raised when "
"trying to load 'tagsegg.templatetags.broken_egg': cannot "
"trying to load 'tagsegg.templatetags.broken_egg': cannot "
"import name '
?Xtemplate'?
"
"import name '
Xtemplate'
"
)
)
with
extend_sys_path
(
egg_name
):
with
extend_sys_path
(
egg_name
):
with
self
.
assertRaisesRegex
(
InvalidTemplateLibrary
,
msg
):
with
self
.
assertRaisesMessage
(
InvalidTemplateLibrary
,
msg
):
Engine
(
libraries
=
{
Engine
(
libraries
=
{
'broken_egg'
:
'tagsegg.templatetags.broken_egg'
})
'broken_egg'
:
'tagsegg.templatetags.broken_egg'
,
})
def
test_load_working_egg
(
self
):
def
test_load_working_egg
(
self
):
ttext
=
"{
%
load working_egg
%
}"
ttext
=
"{
%
load working_egg
%
}"
...
...
tests/template_tests/test_parser.py
Dosyayı görüntüle @
109b33f6
...
@@ -68,7 +68,7 @@ class ParserTests(SimpleTestCase):
...
@@ -68,7 +68,7 @@ class ParserTests(SimpleTestCase):
Variable
(
"article._hidden"
)
Variable
(
"article._hidden"
)
# Variables should raise on non string type
# Variables should raise on non string type
with
self
.
assertRaises
Regex
(
TypeError
,
"Variable must be a string or number, got <(class|type)
'dict'>"
):
with
self
.
assertRaises
Message
(
TypeError
,
"Variable must be a string or number, got <class
'dict'>"
):
Variable
({})
Variable
({})
def
test_filter_args_count
(
self
):
def
test_filter_args_count
(
self
):
...
...
tests/test_utils/tests.py
Dosyayı görüntüle @
109b33f6
...
@@ -362,22 +362,26 @@ class AssertTemplateUsedContextManagerTests(SimpleTestCase):
...
@@ -362,22 +362,26 @@ class AssertTemplateUsedContextManagerTests(SimpleTestCase):
pass
pass
def
test_error_message
(
self
):
def
test_error_message
(
self
):
with
self
.
assertRaisesRegex
(
AssertionError
,
r'^template_used/base\.html'
):
msg
=
'template_used/base.html was not rendered. No template was rendered.'
with
self
.
assertRaisesMessage
(
AssertionError
,
msg
):
with
self
.
assertTemplateUsed
(
'template_used/base.html'
):
with
self
.
assertTemplateUsed
(
'template_used/base.html'
):
pass
pass
with
self
.
assertRaises
Regex
(
AssertionError
,
r'^template_used/base\.html'
):
with
self
.
assertRaises
Message
(
AssertionError
,
msg
):
with
self
.
assertTemplateUsed
(
template_name
=
'template_used/base.html'
):
with
self
.
assertTemplateUsed
(
template_name
=
'template_used/base.html'
):
pass
pass
with
self
.
assertRaisesRegex
(
AssertionError
,
r'^template_used/base\.html.*template_used/alternative\.html$'
):
msg2
=
(
'template_used/base.html was not rendered. Following templates '
'were rendered: template_used/alternative.html'
)
with
self
.
assertRaisesMessage
(
AssertionError
,
msg2
):
with
self
.
assertTemplateUsed
(
'template_used/base.html'
):
with
self
.
assertTemplateUsed
(
'template_used/base.html'
):
render_to_string
(
'template_used/alternative.html'
)
render_to_string
(
'template_used/alternative.html'
)
with
self
.
assertRaises
(
AssertionError
)
as
cm
:
with
self
.
assertRaises
Message
(
AssertionError
,
'No templates used to render the response'
)
:
response
=
self
.
client
.
get
(
'/test_utils/no_template_used/'
)
response
=
self
.
client
.
get
(
'/test_utils/no_template_used/'
)
self
.
assertTemplateUsed
(
response
,
'template_used/base.html'
)
self
.
assertTemplateUsed
(
response
,
'template_used/base.html'
)
self
.
assertEqual
(
cm
.
exception
.
args
[
0
],
"No templates used to render the response"
)
def
test_failure
(
self
):
def
test_failure
(
self
):
with
self
.
assertRaises
(
TypeError
):
with
self
.
assertRaises
(
TypeError
):
...
...
tests/utils_tests/test_module_loading.py
Dosyayı görüntüle @
109b33f6
...
@@ -146,11 +146,11 @@ class AutodiscoverModulesTestCase(SimpleTestCase):
...
@@ -146,11 +146,11 @@ class AutodiscoverModulesTestCase(SimpleTestCase):
autodiscover_modules
(
'missing_module'
)
autodiscover_modules
(
'missing_module'
)
def
test_autodiscover_modules_found_but_bad_module
(
self
):
def
test_autodiscover_modules_found_but_bad_module
(
self
):
with
self
.
assertRaises
Regex
(
ImportError
,
"No module named '?a_package_name_that_does_not_exist'?
"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named 'a_package_name_that_does_not_exist'
"
):
autodiscover_modules
(
'bad_module'
)
autodiscover_modules
(
'bad_module'
)
def
test_autodiscover_modules_several_one_bad_module
(
self
):
def
test_autodiscover_modules_several_one_bad_module
(
self
):
with
self
.
assertRaises
Regex
(
ImportError
,
"No module named '?a_package_name_that_does_not_exist'?
"
):
with
self
.
assertRaises
Message
(
ImportError
,
"No module named 'a_package_name_that_does_not_exist'
"
):
autodiscover_modules
(
'good_module'
,
'bad_module'
)
autodiscover_modules
(
'good_module'
,
'bad_module'
)
def
test_autodiscover_modules_several_found
(
self
):
def
test_autodiscover_modules_several_found
(
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