diff --git a/dev_requirements.txt b/dev_requirements.txt index bd5823d8..b0440ec8 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,6 @@ -r docs/docs-requirements.txt ansible==2.3.1.0 +Django==1.11.5 # for module_finder_test docker==2.5.1 docker[tls]==2.5.1 mock==2.0.0 diff --git a/tests/module_finder_test.py b/tests/module_finder_test.py index 1b18e748..21e9b708 100644 --- a/tests/module_finder_test.py +++ b/tests/module_finder_test.py @@ -144,6 +144,195 @@ class FindRelatedImportsTest(testlib.TestCase): 'mitogen.master', ]) + def test_django_pkg(self): + import django + related = self.call('django') + self.assertEquals(related, [ + 'django', + 'django.utils', + 'django.utils.lru_cache', + 'django.utils.version', + ]) + + def test_django_db(self): + import django.db + related = self.call('django.db') + self.assertEquals(related, [ + 'django', + 'django.conf', + 'django.conf.global_settings', + 'django.core', + 'django.core.exceptions', + 'django.core.signals', + 'django.db', + 'django.db.utils', + 'django.dispatch', + 'django.dispatch.dispatcher', + 'django.dispatch.weakref_backports', + 'django.utils', + 'django.utils._os', + 'django.utils.deprecation', + 'django.utils.encoding', + 'django.utils.functional', + 'django.utils.inspect', + 'django.utils.lru_cache', + 'django.utils.module_loading', + 'django.utils.six', + 'django.utils.version', + ]) + + def test_django_db_models(self): + import django.db.models + related = self.call('django.db.models'), [ + 'django', + 'django.apps', + 'django.conf', + 'django.conf.global_settings', + 'django.core', + 'django.core.cache', + 'django.core.cache.backends', + 'django.core.cache.backends.base', + 'django.core.checks', + 'django.core.checks.caches', + 'django.core.checks.compatibility', + 'django.core.checks.compatibility.django_1_10', + 'django.core.checks.compatibility.django_1_8_0', + 'django.core.checks.database', + 'django.core.checks.model_checks', + 'django.core.checks.security', + 'django.core.checks.security.base', + 'django.core.checks.security.csrf', + 'django.core.checks.security.sessions', + 'django.core.checks.templates', + 'django.core.checks.urls', + 'django.core.checks.utils', + 'django.core.exceptions', + 'django.core.files', + 'django.core.files.base', + 'django.core.files.images', + 'django.core.files.locks', + 'django.core.files.move', + 'django.core.files.storage', + 'django.core.files.utils', + 'django.core.signals', + 'django.core.validators', + 'django.db', + 'django.db.backends', + 'django.db.backends.utils', + 'django.db.models', + 'django.db.models.aggregates', + 'django.db.models.base', + 'django.db.models.constants', + 'django.db.models.deletion', + 'django.db.models.expressions', + 'django.db.models.fields', + 'django.db.models.fields.files', + 'django.db.models.fields.proxy', + 'django.db.models.fields.related', + 'django.db.models.fields.related_descriptors', + 'django.db.models.fields.related_lookups', + 'django.db.models.fields.reverse_related', + 'django.db.models.functions', + 'django.db.models.indexes', + 'django.db.models.lookups', + 'django.db.models.manager', + 'django.db.models.options', + 'django.db.models.query', + 'django.db.models.query_utils', + 'django.db.models.signals', + 'django.db.models.sql', + 'django.db.models.sql.constants', + 'django.db.models.sql.datastructures', + 'django.db.models.sql.query', + 'django.db.models.sql.subqueries', + 'django.db.models.sql.where', + 'django.db.models.utils', + 'django.db.transaction', + 'django.db.utils', + 'django.dispatch', + 'django.dispatch.dispatcher', + 'django.dispatch.weakref_backports', + 'django.forms', + 'django.forms.boundfield', + 'django.forms.fields', + 'django.forms.forms', + 'django.forms.formsets', + 'django.forms.models', + 'django.forms.renderers', + 'django.forms.utils', + 'django.forms.widgets', + 'django.template', + 'django.template.backends', + 'django.template.backends.base', + 'django.template.backends.django', + 'django.template.backends.jinja2', + 'django.template.base', + 'django.template.context', + 'django.template.engine', + 'django.template.exceptions', + 'django.template.library', + 'django.template.loader', + 'django.template.utils', + 'django.templatetags', + 'django.templatetags.static', + 'django.utils', + 'django.utils._os', + 'django.utils.crypto', + 'django.utils.datastructures', + 'django.utils.dateformat', + 'django.utils.dateparse', + 'django.utils.dates', + 'django.utils.datetime_safe', + 'django.utils.deconstruct', + 'django.utils.decorators', + 'django.utils.deprecation', + 'django.utils.duration', + 'django.utils.encoding', + 'django.utils.formats', + 'django.utils.functional', + 'django.utils.html', + 'django.utils.html_parser', + 'django.utils.http', + 'django.utils.inspect', + 'django.utils.ipv6', + 'django.utils.itercompat', + 'django.utils.lru_cache', + 'django.utils.module_loading', + 'django.utils.numberformat', + 'django.utils.safestring', + 'django.utils.six', + 'django.utils.text', + 'django.utils.timezone', + 'django.utils.translation', + 'django.utils.tree', + 'django.utils.version', + 'jinja2', + 'jinja2._compat', + 'jinja2.bccache', + 'jinja2.compiler', + 'jinja2.defaults', + 'jinja2.environment', + 'jinja2.exceptions', + 'jinja2.filters', + 'jinja2.idtracking', + 'jinja2.lexer', + 'jinja2.loaders', + 'jinja2.nodes', + 'jinja2.optimizer', + 'jinja2.parser', + 'jinja2.runtime', + 'jinja2.tests', + 'jinja2.utils', + 'jinja2.visitor', + 'markupsafe', + 'markupsafe._compat', + 'markupsafe._speedups', + 'pytz', + 'pytz.exceptions', + 'pytz.lazy', + 'pytz.tzfile', + 'pytz.tzinfo', + ]) if __name__ == '__main__': unittest2.main()