Assorted test fixes for the Azure automated test run. (#1123)

This commit is contained in:
Pavel Minaev 2019-01-25 17:48:56 -08:00 committed by GitHub
parent 92218e7c45
commit 26cc6b0a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 25 deletions

View file

@ -1,5 +1,5 @@
[pytest]
testpaths=tests
timeout=15
timeout=30
timeout_method=thread
addopts=-n8

View file

@ -698,37 +698,50 @@ class ModulesManager(object):
pass
search_path = self._get_platform_file_path(module_path)
for _, value in list(sys.modules.items()):
try:
path = self._get_platform_file_path(value.__file__)
except AttributeError:
path = None
if path and search_path == path:
module_id = self._next_id
self._next_id += 1
if not path:
continue
module = {
'id': module_id,
'package': value.__package__ if hasattr(value, '__package__') else None,
'path': module_path,
}
try:
# This tries to open the files to obtain handles, which can be restricted
# by file permissions, but ensures that long/short path mismatch, symlinks
# etc are all accounted for. Fall back to comparing names in case of failure.
if not os.path.samefile(path, search_path):
continue
except Exception:
if path != search_path:
continue
try:
module['name'] = value.__qualname__
except AttributeError:
module['name'] = value.__name__
module_id = self._next_id
self._next_id += 1
try:
module['version'] = value.__version__
except AttributeError:
pass
module = {
'id': module_id,
'package': value.__package__ if hasattr(value, '__package__') else None,
'path': module_path,
}
self.path_to_module_id[module_path] = module_id
self.module_id_to_details[module_id] = module
try:
module['name'] = value.__qualname__
except AttributeError:
module['name'] = value.__name__
self.proc.send_event('module', reason='new', module=module)
return module
try:
module['version'] = value.__version__
except AttributeError:
pass
self.path_to_module_id[module_path] = module_id
self.module_id_to_details[module_id] = module
self.proc.send_event('module', reason='new', module=module)
return module
return None

View file

@ -20,7 +20,7 @@ import ptvsd.__main__
from ptvsd.messaging import JsonIOStream, JsonMessageChannel, MessageHandlers
import tests.helpers
from . import colors, debuggee, print, watchdog
from . import colors, debuggee, print
from .messaging import LoggingJsonStream
from .pattern import ANY
from .printer import wait_for_output
@ -34,8 +34,8 @@ PTVSD_PORT_KEY = 'PTVSD_TEST_PORT'
class DebugSession(object):
WAIT_FOR_EXIT_TIMEOUT = 5
BACKCHANNEL_TIMEOUT = 15
WAIT_FOR_EXIT_TIMEOUT = 10
BACKCHANNEL_TIMEOUT = 20
StopInfo = namedtuple('StopInfo', 'thread_stopped, stacktrace, thread_id, frame_id')
@ -268,7 +268,7 @@ class DebugSession(object):
self.pid = self.process.pid
self.psutil_process = psutil.Process(self.pid)
self.is_running = True
watchdog.create(self.pid)
#watchdog.create(self.pid)
self._capture_output(self.process.stdout, 'OUT')
self._capture_output(self.process.stderr, 'ERR')
@ -585,6 +585,7 @@ class DebugSession(object):
child_session.handshake()
except:
child_session.close()
raise
else:
return child_session