|
|
@ -162,16 +162,63 @@ class ResolveRelPathTest(testlib.TestCase):
|
|
|
|
self.assertEquals('', self.call('email.utils', 3))
|
|
|
|
self.assertEquals('', self.call('email.utils', 3))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DjangoMixin(object):
|
|
|
|
class FakeSshTest(testlib.TestCase):
|
|
|
|
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def call(self, fullname):
|
|
|
|
|
|
|
|
return self.klass().find_related_imports(fullname)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_simple(self):
|
|
|
|
|
|
|
|
import mitogen.fakessh
|
|
|
|
|
|
|
|
related = self.call('mitogen.fakessh')
|
|
|
|
|
|
|
|
self.assertEquals(related, [
|
|
|
|
|
|
|
|
'mitogen',
|
|
|
|
|
|
|
|
'mitogen.core',
|
|
|
|
|
|
|
|
'mitogen.master',
|
|
|
|
|
|
|
|
'mitogen.parent',
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FindRelatedTest(testlib.TestCase):
|
|
|
|
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def call(self, fullname):
|
|
|
|
|
|
|
|
return self.klass().find_related(fullname)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SIMPLE_EXPECT = set([
|
|
|
|
|
|
|
|
u'mitogen',
|
|
|
|
|
|
|
|
u'mitogen.core',
|
|
|
|
|
|
|
|
u'mitogen.master',
|
|
|
|
|
|
|
|
u'mitogen.minify',
|
|
|
|
|
|
|
|
u'mitogen.parent',
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info < (3, 2):
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat')
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat.functools')
|
|
|
|
|
|
|
|
if sys.version_info < (2, 7):
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat.tokenize')
|
|
|
|
|
|
|
|
if sys.version_info < (2, 6):
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat.pkgutil')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_simple(self):
|
|
|
|
|
|
|
|
import mitogen.fakessh
|
|
|
|
|
|
|
|
related = self.call('mitogen.fakessh')
|
|
|
|
|
|
|
|
self.assertEquals(set(related), self.SIMPLE_EXPECT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info > (2, 6):
|
|
|
|
|
|
|
|
class DjangoMixin(object):
|
|
|
|
WEBPROJECT_PATH = testlib.data_path('webproject')
|
|
|
|
WEBPROJECT_PATH = testlib.data_path('webproject')
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: rip out Django and replace with a static tree of weird imports that
|
|
|
|
# TODO: rip out Django and replace with a static tree of weird imports
|
|
|
|
# don't depend on .. Django! The hack below is because the version of
|
|
|
|
# that don't depend on .. Django! The hack below is because the version
|
|
|
|
# Django we need to test against 2.6 doesn't actually run on 3.6. But we
|
|
|
|
# of Django we need to test against 2.6 doesn't actually run on 3.6.
|
|
|
|
# don't care, we just need to be able to import it.
|
|
|
|
# But we don't care, we just need to be able to import it.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# File "django/utils/html_parser.py", line 12, in <module>
|
|
|
|
# File "django/utils/html_parser.py", line 12, in <module>
|
|
|
|
# AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
|
|
|
|
# AttributeError: module 'html.parser' has no attribute
|
|
|
|
|
|
|
|
# 'HTMLParseError'
|
|
|
|
#
|
|
|
|
#
|
|
|
|
import pkg_resources._vendor.six
|
|
|
|
import pkg_resources._vendor.six
|
|
|
|
from django.utils.six.moves import html_parser as _html_parser
|
|
|
|
from django.utils.six.moves import html_parser as _html_parser
|
|
|
@ -190,22 +237,12 @@ class DjangoMixin(object):
|
|
|
|
super(DjangoMixin, cls).tearDownClass()
|
|
|
|
super(DjangoMixin, cls).tearDownClass()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FindRelatedImportsTest(DjangoMixin, testlib.TestCase):
|
|
|
|
class FindRelatedImportsTest(DjangoMixin, testlib.TestCase):
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
|
|
|
|
|
|
|
|
def call(self, fullname):
|
|
|
|
def call(self, fullname):
|
|
|
|
return self.klass().find_related_imports(fullname)
|
|
|
|
return self.klass().find_related_imports(fullname)
|
|
|
|
|
|
|
|
|
|
|
|
def test_simple(self):
|
|
|
|
|
|
|
|
import mitogen.fakessh
|
|
|
|
|
|
|
|
related = self.call('mitogen.fakessh')
|
|
|
|
|
|
|
|
self.assertEquals(related, [
|
|
|
|
|
|
|
|
'mitogen',
|
|
|
|
|
|
|
|
'mitogen.core',
|
|
|
|
|
|
|
|
'mitogen.master',
|
|
|
|
|
|
|
|
'mitogen.parent',
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_django_db(self):
|
|
|
|
def test_django_db(self):
|
|
|
|
import django.db
|
|
|
|
import django.db
|
|
|
|
related = self.call('django.db')
|
|
|
|
related = self.call('django.db')
|
|
|
@ -241,33 +278,7 @@ class FindRelatedImportsTest(DjangoMixin, testlib.TestCase):
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FindRelatedTest(DjangoMixin, testlib.TestCase):
|
|
|
|
class DjangoFindRelatedTest(DjangoMixin, testlib.TestCase):
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def call(self, fullname):
|
|
|
|
|
|
|
|
return self.klass().find_related(fullname)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SIMPLE_EXPECT = set([
|
|
|
|
|
|
|
|
u'mitogen',
|
|
|
|
|
|
|
|
u'mitogen.core',
|
|
|
|
|
|
|
|
u'mitogen.master',
|
|
|
|
|
|
|
|
u'mitogen.minify',
|
|
|
|
|
|
|
|
u'mitogen.parent',
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info < (3, 2):
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat')
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat.functools')
|
|
|
|
|
|
|
|
if sys.version_info < (2, 7):
|
|
|
|
|
|
|
|
SIMPLE_EXPECT.add('mitogen.compat.tokenize')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_simple(self):
|
|
|
|
|
|
|
|
import mitogen.fakessh
|
|
|
|
|
|
|
|
related = self.call('mitogen.fakessh')
|
|
|
|
|
|
|
|
self.assertEquals(set(related), self.SIMPLE_EXPECT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DjangoFindRelatedTest(DjangoMixin, testlib.TestCase):
|
|
|
|
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
klass = mitogen.master.ModuleFinder
|
|
|
|
maxDiff = None
|
|
|
|
maxDiff = None
|
|
|
|
|
|
|
|
|
|
|
@ -297,10 +308,11 @@ class DjangoFindRelatedTest(DjangoMixin, testlib.TestCase):
|
|
|
|
u'django.utils.six',
|
|
|
|
u'django.utils.six',
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@unittest2.skipIf(
|
|
|
|
|
|
|
|
condition=(sys.version_info >= (3, 0)),
|
|
|
|
|
|
|
|
reason='broken due to ancient vendored six.py'
|
|
|
|
|
|
|
|
)
|
|
|
|
def test_django_db_models(self):
|
|
|
|
def test_django_db_models(self):
|
|
|
|
if sys.version_info >= (3, 0):
|
|
|
|
|
|
|
|
raise unittest2.SkipTest('broken due to ancient vendored six.py')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import django.db.models
|
|
|
|
import django.db.models
|
|
|
|
related = self.call('django.db.models')
|
|
|
|
related = self.call('django.db.models')
|
|
|
|
self.assertEquals(related, [
|
|
|
|
self.assertEquals(related, [
|
|
|
|