Fixed #25246 -- Guarded against duplicate paths in AppConfig.

This commit is contained in:
Caio Ariede 2015-08-23 21:07:00 -03:00 committed by Tim Graham
parent 722bf23518
commit 6a98396b9d
2 changed files with 12 additions and 0 deletions

View file

@ -365,6 +365,14 @@ class AppConfigTests(SimpleTestCase):
with self.assertRaises(ImproperlyConfigured):
AppConfig('label', Stub(__path__=['a', 'b']))
def test_duplicate_dunder_path_no_dunder_file(self):
"""
If the __path__ attr contains duplicate paths and there is no
__file__, they duplicates should be deduplicated (#25246).
"""
ac = AppConfig('label', Stub(__path__=['a', 'a']))
self.assertEqual(ac.path, 'a')
@skipUnless(six.PY3, "Namespace packages sans __init__.py were added in Python 3.3")
class NamespacePackageAppTests(SimpleTestCase):