Merge pull request #1016 from moreati/pr987

Prepare for Python 3.11
pull/1019/head
Alex Willmer 1 year ago committed by GitHub
commit 57b5be3589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,7 +10,10 @@ import shutil
import sys import sys
import tempfile import tempfile
import subprocess32 as subprocess if sys.version_info < (3, 0):
import subprocess32 as subprocess
else:
import subprocess
try: try:
import urlparse import urlparse

@ -0,0 +1,186 @@
{
"find_related_imports": {
"django.db": [
"django",
"django.core",
"django.core.signals",
"django.db.utils"
],
"django.db.models": [
"django",
"django.core.exceptions",
"django.db",
"django.db.models",
"django.db.models.aggregates",
"django.db.models.base",
"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.indexes",
"django.db.models.lookups",
"django.db.models.manager",
"django.db.models.query",
"django.db.models.signals"
]
},
"find_related": {
"django.db": [
"django",
"django.conf",
"django.conf.global_settings",
"django.core",
"django.core.exceptions",
"django.core.signals",
"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"
],
"django.db.models": [
"django",
"django.apps",
"django.apps.config",
"django.apps.registry",
"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.messages",
"django.core.checks.model_checks",
"django.core.checks.registry",
"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.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.functions.base",
"django.db.models.functions.datetime",
"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.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",
"pytz",
"pytz.exceptions",
"pytz.lazy",
"pytz.tzfile",
"pytz.tzinfo"
]
}
}

@ -0,0 +1,209 @@
{
"find_related_imports": {
"django.db": [
"django",
"django.core",
"django.core.signals",
"django.db.utils",
"django.utils.connection"
],
"django.db.models": [
"django",
"django.core.exceptions",
"django.db",
"django.db.models",
"django.db.models.aggregates",
"django.db.models.base",
"django.db.models.constraints",
"django.db.models.deletion",
"django.db.models.enums",
"django.db.models.expressions",
"django.db.models.fields",
"django.db.models.fields.files",
"django.db.models.fields.json",
"django.db.models.fields.proxy",
"django.db.models.fields.related",
"django.db.models.indexes",
"django.db.models.lookups",
"django.db.models.manager",
"django.db.models.query",
"django.db.models.query_utils",
"django.db.models.signals"
]
},
"find_related": {
"django.db": [
"asgiref",
"asgiref.compatibility",
"asgiref.current_thread_executor",
"asgiref.local",
"asgiref.sync",
"django",
"django.conf",
"django.conf.global_settings",
"django.core",
"django.core.exceptions",
"django.core.signals",
"django.db.utils",
"django.dispatch",
"django.dispatch.dispatcher",
"django.utils",
"django.utils.connection",
"django.utils.deprecation",
"django.utils.functional",
"django.utils.hashable",
"django.utils.inspect",
"django.utils.itercompat",
"django.utils.module_loading",
"django.utils.regex_helper",
"django.utils.version"
],
"django.db.models": [
"asgiref",
"asgiref.compatibility",
"asgiref.current_thread_executor",
"asgiref.local",
"asgiref.sync",
"django",
"django.apps",
"django.apps.config",
"django.apps.registry",
"django.conf",
"django.conf.global_settings",
"django.conf.locale",
"django.core",
"django.core.cache",
"django.core.cache.backends",
"django.core.cache.backends.base",
"django.core.cache.backends.filebased",
"django.core.checks",
"django.core.checks.async_checks",
"django.core.checks.caches",
"django.core.checks.database",
"django.core.checks.messages",
"django.core.checks.model_checks",
"django.core.checks.registry",
"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.translation",
"django.core.checks.urls",
"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.aggregates",
"django.db.models.base",
"django.db.models.constants",
"django.db.models.constraints",
"django.db.models.deletion",
"django.db.models.enums",
"django.db.models.expressions",
"django.db.models.fields",
"django.db.models.fields.files",
"django.db.models.fields.json",
"django.db.models.fields.mixins",
"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.functions.comparison",
"django.db.models.functions.datetime",
"django.db.models.functions.math",
"django.db.models.functions.mixins",
"django.db.models.functions.text",
"django.db.models.functions.window",
"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.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.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.autoreload",
"django.utils.connection",
"django.utils.crypto",
"django.utils.datastructures",
"django.utils.dateformat",
"django.utils.dateparse",
"django.utils.dates",
"django.utils.datetime_safe",
"django.utils.deconstruct",
"django.utils.deprecation",
"django.utils.duration",
"django.utils.encoding",
"django.utils.formats",
"django.utils.functional",
"django.utils.hashable",
"django.utils.html",
"django.utils.http",
"django.utils.inspect",
"django.utils.ipv6",
"django.utils.itercompat",
"django.utils.module_loading",
"django.utils.numberformat",
"django.utils.regex_helper",
"django.utils.safestring",
"django.utils.text",
"django.utils.timezone",
"django.utils.topological_sort",
"django.utils.translation",
"django.utils.translation.trans_real",
"django.utils.tree",
"django.utils.version",
"pytz",
"pytz.exceptions",
"pytz.lazy",
"pytz.tzfile",
"pytz.tzinfo"
]
}
}

@ -0,0 +1,209 @@
{
"find_related_imports": {
"django.db": [
"django",
"django.core",
"django.core.signals",
"django.db.utils",
"django.utils.connection"
],
"django.db.models": [
"django",
"django.core.exceptions",
"django.db",
"django.db.models",
"django.db.models.aggregates",
"django.db.models.base",
"django.db.models.constraints",
"django.db.models.deletion",
"django.db.models.enums",
"django.db.models.expressions",
"django.db.models.fields",
"django.db.models.fields.files",
"django.db.models.fields.json",
"django.db.models.fields.proxy",
"django.db.models.fields.related",
"django.db.models.indexes",
"django.db.models.lookups",
"django.db.models.manager",
"django.db.models.query",
"django.db.models.query_utils",
"django.db.models.signals"
]
},
"find_related": {
"django.db": [
"asgiref",
"asgiref.current_thread_executor",
"asgiref.local",
"asgiref.sync",
"django",
"django.conf",
"django.conf.global_settings",
"django.core",
"django.core.exceptions",
"django.core.signals",
"django.db.utils",
"django.dispatch",
"django.dispatch.dispatcher",
"django.utils",
"django.utils.connection",
"django.utils.deprecation",
"django.utils.functional",
"django.utils.hashable",
"django.utils.inspect",
"django.utils.itercompat",
"django.utils.module_loading",
"django.utils.regex_helper",
"django.utils.version"
],
"django.db.models": [
"asgiref",
"asgiref.current_thread_executor",
"asgiref.local",
"asgiref.sync",
"django",
"django.apps",
"django.apps.config",
"django.apps.registry",
"django.conf",
"django.conf.global_settings",
"django.conf.locale",
"django.core",
"django.core.cache",
"django.core.cache.backends",
"django.core.cache.backends.base",
"django.core.cache.backends.filebased",
"django.core.checks",
"django.core.checks.async_checks",
"django.core.checks.caches",
"django.core.checks.database",
"django.core.checks.messages",
"django.core.checks.model_checks",
"django.core.checks.registry",
"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.translation",
"django.core.checks.urls",
"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.aggregates",
"django.db.models.base",
"django.db.models.constants",
"django.db.models.constraints",
"django.db.models.deletion",
"django.db.models.enums",
"django.db.models.expressions",
"django.db.models.fields",
"django.db.models.fields.files",
"django.db.models.fields.json",
"django.db.models.fields.mixins",
"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.functions.comparison",
"django.db.models.functions.datetime",
"django.db.models.functions.math",
"django.db.models.functions.mixins",
"django.db.models.functions.text",
"django.db.models.functions.window",
"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.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.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.autoreload",
"django.utils.connection",
"django.utils.crypto",
"django.utils.datastructures",
"django.utils.dateformat",
"django.utils.dateparse",
"django.utils.dates",
"django.utils.datetime_safe",
"django.utils.deconstruct",
"django.utils.deprecation",
"django.utils.duration",
"django.utils.encoding",
"django.utils.formats",
"django.utils.functional",
"django.utils.hashable",
"django.utils.html",
"django.utils.http",
"django.utils.inspect",
"django.utils.ipv6",
"django.utils.itercompat",
"django.utils.module_loading",
"django.utils.numberformat",
"django.utils.regex_helper",
"django.utils.safestring",
"django.utils.text",
"django.utils.timezone",
"django.utils.topological_sort",
"django.utils.translation",
"django.utils.translation.trans_real",
"django.utils.tree",
"django.utils.version",
"pytz",
"pytz.exceptions",
"pytz.lazy",
"pytz.tzfile",
"pytz.tzinfo",
"zipimport"
]
}
}

@ -1,4 +1,5 @@
import inspect import inspect
import json
import os import os
import sys import sys
import unittest import unittest
@ -296,27 +297,26 @@ class FindRelatedTest(testlib.TestCase):
self.assertEqual(set(related), self.SIMPLE_EXPECT) self.assertEqual(set(related), self.SIMPLE_EXPECT)
if sys.version_info > (2, 6): class DjangoMixin(object):
class DjangoMixin(object):
WEBPROJECT_PATH = os.path.join(testlib.MODS_DIR, 'webproject') WEBPROJECT_PATH = os.path.join(testlib.MODS_DIR, 'webproject')
# TODO: rip out Django and replace with a static tree of weird imports @classmethod
# that don't depend on .. Django! The hack below is because the version def modules_expected_path(cls):
# of Django we need to test against 2.6 doesn't actually run on 3.6. if sys.version_info[0:2] < (3, 0):
# But we don't care, we just need to be able to import it. modules_expected_filename = 'modules_expected_py2x.json'
# elif sys.version_info[0:2] <= (3, 6):
# File "django/utils/html_parser.py", line 12, in <module> modules_expected_filename = 'modules_expected_py3x-legacy.json'
# AttributeError: module 'html.parser' has no attribute elif sys.version_info[0:2] >= (3, 10):
# 'HTMLParseError' modules_expected_filename = 'modules_expected_py3x-new.json'
# return os.path.join(cls.WEBPROJECT_PATH, modules_expected_filename)
from django.utils.six.moves import html_parser as _html_parser
_html_parser.HTMLParseError = Exception
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(DjangoMixin, cls).setUpClass() super(DjangoMixin, cls).setUpClass()
sys.path.append(cls.WEBPROJECT_PATH) sys.path.append(cls.WEBPROJECT_PATH)
os.environ['DJANGO_SETTINGS_MODULE'] = 'webproject.settings' os.environ['DJANGO_SETTINGS_MODULE'] = 'webproject.settings'
with open(cls.modules_expected_path(), 'rb') as f:
cls.MODULES_EXPECTED = json.load(f)
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
@ -325,170 +325,37 @@ if sys.version_info > (2, 6):
super(DjangoMixin, cls).tearDownClass() super(DjangoMixin, cls).tearDownClass()
class FindRelatedImportsTest(DjangoMixin, testlib.TestCase): class DjangoFindRelatedTest(DjangoMixin, testlib.TestCase):
klass = mitogen.master.ModuleFinder maxDiff = None
def call(self, fullname):
return self.klass().find_related_imports(fullname)
def test_django_db(self): def test_django_db(self):
import django.db import django.db
related = self.call('django.db') module_finder = mitogen.master.ModuleFinder()
self.assertEqual(related, [ related = module_finder.find_related('django.db')
'django', expected = self.MODULES_EXPECTED['find_related']['django.db']
'django.core', self.assertEqual(related, expected)
'django.core.signals',
'django.db.utils',
'django.utils.functional',
])
def test_django_db_models(self): def test_django_db_models(self):
import django.db.models import django.db.models
related = self.call('django.db.models') module_finder = mitogen.master.ModuleFinder()
self.maxDiff=None related = module_finder.find_related('django.db.models')
self.assertEqual(related, [ expected = self.MODULES_EXPECTED['find_related']['django.db.models']
u'django', self.assertEqual(related, expected)
u'django.core.exceptions',
u'django.db',
u'django.db.models',
u'django.db.models.aggregates',
u'django.db.models.base',
u'django.db.models.deletion',
u'django.db.models.expressions',
u'django.db.models.fields',
u'django.db.models.fields.files',
u'django.db.models.fields.related',
u'django.db.models.fields.subclassing',
u'django.db.models.loading',
u'django.db.models.manager',
u'django.db.models.query',
u'django.db.models.signals',
])
class DjangoFindRelatedTest(DjangoMixin, testlib.TestCase): class DjangoFindRelatedImportsTest(DjangoMixin, testlib.TestCase):
klass = mitogen.master.ModuleFinder
maxDiff = None maxDiff = None
def call(self, fullname):
return self.klass().find_related(fullname)
def test_django_db(self): def test_django_db(self):
import django.db import django.db
related = self.call('django.db') module_finder = mitogen.master.ModuleFinder()
self.assertEqual(related, [ related = module_finder.find_related_imports('django.db')
u'django', expected = self.MODULES_EXPECTED['find_related_imports']['django.db']
u'django.conf', self.assertEqual(related, expected)
u'django.conf.global_settings',
u'django.core',
u'django.core.exceptions',
u'django.core.signals',
u'django.db.utils',
u'django.dispatch',
u'django.dispatch.dispatcher',
u'django.dispatch.saferef',
u'django.utils',
u'django.utils._os',
u'django.utils.encoding',
u'django.utils.functional',
u'django.utils.importlib',
u'django.utils.module_loading',
u'django.utils.six',
])
@unittest.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):
import django.db.models import django.db.models
related = self.call('django.db.models') module_finder = mitogen.master.ModuleFinder()
self.assertEqual(related, [ related = module_finder.find_related_imports('django.db.models')
u'django', expected = self.MODULES_EXPECTED['find_related_imports']['django.db.models']
u'django.conf', self.assertEqual(related, expected)
u'django.conf.global_settings',
u'django.core',
u'django.core.exceptions',
u'django.core.files',
u'django.core.files.base',
u'django.core.files.images',
u'django.core.files.locks',
u'django.core.files.move',
u'django.core.files.storage',
u'django.core.files.utils',
u'django.core.signals',
u'django.core.validators',
u'django.db',
u'django.db.backends',
u'django.db.backends.signals',
u'django.db.backends.util',
u'django.db.models.aggregates',
u'django.db.models.base',
u'django.db.models.constants',
u'django.db.models.deletion',
u'django.db.models.expressions',
u'django.db.models.fields',
u'django.db.models.fields.files',
u'django.db.models.fields.proxy',
u'django.db.models.fields.related',
u'django.db.models.fields.subclassing',
u'django.db.models.loading',
u'django.db.models.manager',
u'django.db.models.options',
u'django.db.models.query',
u'django.db.models.query_utils',
u'django.db.models.related',
u'django.db.models.signals',
u'django.db.models.sql',
u'django.db.models.sql.aggregates',
u'django.db.models.sql.constants',
u'django.db.models.sql.datastructures',
u'django.db.models.sql.expressions',
u'django.db.models.sql.query',
u'django.db.models.sql.subqueries',
u'django.db.models.sql.where',
u'django.db.transaction',
u'django.db.utils',
u'django.dispatch',
u'django.dispatch.dispatcher',
u'django.dispatch.saferef',
u'django.forms',
u'django.forms.fields',
u'django.forms.forms',
u'django.forms.formsets',
u'django.forms.models',
u'django.forms.util',
u'django.forms.widgets',
u'django.utils',
u'django.utils._os',
u'django.utils.crypto',
u'django.utils.datastructures',
u'django.utils.dateformat',
u'django.utils.dateparse',
u'django.utils.dates',
u'django.utils.datetime_safe',
u'django.utils.decorators',
u'django.utils.deprecation',
u'django.utils.encoding',
u'django.utils.formats',
u'django.utils.functional',
u'django.utils.html',
u'django.utils.html_parser',
u'django.utils.importlib',
u'django.utils.ipv6',
u'django.utils.itercompat',
u'django.utils.module_loading',
u'django.utils.numberformat',
u'django.utils.safestring',
u'django.utils.six',
u'django.utils.text',
u'django.utils.timezone',
u'django.utils.translation',
u'django.utils.tree',
u'django.utils.tzinfo',
u'pytz',
u'pytz.exceptions',
u'pytz.lazy',
u'pytz.tzfile',
u'pytz.tzinfo',
])

@ -1,14 +1,14 @@
psutil==5.4.8 psutil==5.4.8
coverage==5.5; python_version < '3.7' coverage==5.5; python_version < '3.7'
coverage==6.4.4; python_version >= '3.7' coverage==6.4.4; python_version >= '3.7'
Django==1.6.11 # Last version supporting 2.6. Django==1.11.29; python_version < '3.0'
Django==3.2.20; python_version >= '3.6'
mock==2.0.0 mock==2.0.0
pytz==2018.5
cffi==1.14.3 # Random pin to try and fix pyparser==2.18 not having effect cffi==1.14.3 # Random pin to try and fix pyparser==2.18 not having effect
pycparser==2.18 # Last version supporting 2.6. pycparser==2.18 # Last version supporting 2.6.
pytest-catchlog==1.2.2 pytest-catchlog==1.2.2
pytest==3.1.2 pytest==3.1.2
subprocess32==3.5.4 subprocess32==3.5.4; python_version < '3.0'
timeoutcontext==1.2.0 timeoutcontext==1.2.0
# Fix InsecurePlatformWarning while creating py26 tox environment # Fix InsecurePlatformWarning while creating py26 tox environment
# https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings # https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

@ -18,7 +18,10 @@ except ImportError:
import ConfigParser as configparser import ConfigParser as configparser
import psutil import psutil
import subprocess32 as subprocess if sys.version_info < (3, 0):
import subprocess32 as subprocess
else:
import subprocess
import mitogen.core import mitogen.core
import mitogen.fork import mitogen.fork
@ -499,19 +502,18 @@ def get_docker_host():
class DockerizedSshDaemon(object): class DockerizedSshDaemon(object):
def _get_container_port(self): PORT_RE = re.compile(
s = subprocess.check_output(['docker', 'port', self.container_name]) # e.g. 0.0.0.0:32771, :::32771, [::]:32771'
for line in s.decode().splitlines(): r'(?P<addr>[0-9.]+|::|\[[a-f0-9:.]+\]):(?P<port>[0-9]+)',
m = self.PORT_RE.match(line) )
if not m:
continue
dport, proto, _, bport = m.groups()
if dport == '22' and proto == 'tcp':
self.port = int(bport)
self.host = self.get_host() @classmethod
if self.port is None: def get_port(cls, container):
s = subprocess.check_output(['docker', 'port', container, '22/tcp'])
m = cls.PORT_RE.search(s.decode())
if not m:
raise ValueError('could not find SSH port in: %r' % (s,)) raise ValueError('could not find SSH port in: %r' % (s,))
return int(m.group('port'))
def start_container(self): def start_container(self):
try: try:
@ -530,7 +532,6 @@ class DockerizedSshDaemon(object):
self.image, self.image,
] ]
subprocess.check_output(args) subprocess.check_output(args)
self._get_container_port()
def __init__(self, mitogen_test_distro=os.environ.get('MITOGEN_TEST_DISTRO', 'debian9')): def __init__(self, mitogen_test_distro=os.environ.get('MITOGEN_TEST_DISTRO', 'debian9')):
if '-' in mitogen_test_distro: if '-' in mitogen_test_distro:
@ -545,12 +546,9 @@ class DockerizedSshDaemon(object):
self.python_path = '/usr/bin/python' self.python_path = '/usr/bin/python'
self.image = 'public.ecr.aws/n5z0e8q9/%s-test' % (distro,) self.image = 'public.ecr.aws/n5z0e8q9/%s-test' % (distro,)
# 22/tcp -> 0.0.0.0:32771
self.PORT_RE = re.compile(r'([^/]+)/([^ ]+) -> ([^:]+):(.*)')
self.port = None
self.start_container() self.start_container()
self.host = self.get_host()
self.port = self.get_port(self.container_name)
def get_host(self): def get_host(self):
return get_docker_host() return get_docker_host()

@ -5,15 +5,15 @@
# sudo apt update # sudo apt update
# sudo apt install awscli lib{ldap2,sasl2,ssl}-dev python2.7 python3.{6..11} python-is-python3 sshpass tox # sudo apt install awscli lib{ldap2,sasl2,ssl}-dev python2.7 python3.{6..11} python-is-python3 sshpass tox
# Py tox virtualenv pip A cntrllr A target Jinja2 coverage psutil pytest # Py A cntrllr A target coverage Django Jinja2 pip psutil pytest tox virtualenv
# ==== ======== ========== ======== ========= ========= ========== ======== ======== ========= # ==== ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
# 2.4 <= 1.4 <= 1.8 <= 1.1 2.3? <= 3.7.1 <= 2.1.3 # 2.4 2.3? <= 3.7.1 <= 1.3.7 <= 1.1 <= 2.1.3 <= 1.4 <= 1.8
# 2.5 <= 1.6.1 <= 1.9.1 <= 1.3.1 ??? <= 3.7.1 <= 2.1.3 <= 2.8.7 # 2.5 <= 3.7.1 <= 1.4.22 <= 1.3.1 <= 2.1.3 <= 2.8.7 <= 1.6.1 <= 1.9.1
# 2.6 <= 2.9.1 <= 15.2.0 <= 9.0.3 <= 2.6.20 <= 2.13 <= 2.10.3 <= 4.5.4 <= 5.9.0 <= 3.2.5 # 2.6 <= 2.6.20 <= 2.13 <= 4.5.4 <= 1.6.11 <= 2.10.3 <= 9.0.3 <= 5.9.0 <= 3.2.5 <= 2.9.1 <= 15.2.0
# 2.7 <= 3.28 <= 20.3? <= 20 <= 2.11 <= 2.11.3 <= 5.6 <= 4.6.11 # 2.7 <= 2.11 <= 5.6 <= 1.11.29 <= 2.11.3 <= 20 <= 4.6.11 <= 3.28 <= 20.3?
# 3.5 <= 3.28 <= 20.15 <= 20 <= 2.11 <= 2.13 <= 2.11.3 <= 5.6 <= 6.1.0 # 3.5 <= 2.11 <= 2.13 <= 5.6 <= 2.2.28 <= 2.11.3 <= 20 <= 5.9.5 <= 6.1.0 <= 3.28 <= 20.15
# 3.6 <= 3.28 <= 20.16 <= 21 <= 2.11 <= 3.0.3 <= 6.2 <= 7.0.1 # 3.6 <= 2.11 <= 6.2 <= 3.2.20 <= 3.0.3 <= 21 <= 5.9.5 <= 7.0.1 <= 3.28 <= 20.16
# 3.7 <= 2.12 # 3.7 <= 2.12 <= 3.2.20
# 3.8 <= 2.12 # 3.8 <= 2.12
# Ansible Dependency # Ansible Dependency

Loading…
Cancel
Save