From 7646a7f9c20e42ea1387176e1aae1560ac601d84 Mon Sep 17 00:00:00 2001 From: Nivedha Date: Wed, 5 Aug 2020 14:04:16 +0530 Subject: [PATCH] Use debugpy instead of ptvsd (#185) * #180 Use debugpy instead of ptvsd - since vscode removes support for ptvsd soon Signed-off-by: NivedhaSenthil * Fix build.py Signed-off-by: BugDiver Co-authored-by: BugDiver --- build.py | 2 +- getgauge/processor.py | 1 - requirements.txt | 4 ++-- setup.tmpl | 2 +- start.py | 7 +++---- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 7123447..e9f0f8b 100644 --- a/build.py +++ b/build.py @@ -108,7 +108,7 @@ def run_tests(): if item.startswith("test_") and item.endswith(".py"): fileNamePath = str(os.path.join(root, item)) exit_code = call([sys.executable, fileNamePath] - ) if exit_code is 0 else exit_code + ) if exit_code == 0 else exit_code return exit_code diff --git a/getgauge/processor.py b/getgauge/processor.py index e24197a..c630fa2 100644 --- a/getgauge/processor.py +++ b/getgauge/processor.py @@ -3,7 +3,6 @@ from os import environ, path from threading import Timer -import ptvsd from getgauge import logger from getgauge.executor import (create_execution_status_response, execute_method, run_hook) diff --git a/requirements.txt b/requirements.txt index c7ec48f..fdfac5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,9 @@ six pyfakefs==4.1.0 redbaron twine -ptvsd==4.3.2 +debugpy grpcio-tools grpcio==1.30.0 protobuf>=3.5.2 parso -futures \ No newline at end of file +futures diff --git a/setup.tmpl b/setup.tmpl index c9a5abd..35e7a32 100644 --- a/setup.tmpl +++ b/setup.tmpl @@ -22,6 +22,6 @@ setup( 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', ], - install_requires=['redBaron', 'parso', 'ptvsd==4.3.2', 'grpcio==1.28.1', 'protobuf>=3.5.2', 'six'], + install_requires=['redBaron', 'parso', 'debugpy', 'grpcio==1.28.1', 'protobuf>=3.5.2', 'six'], extras_require={1}, ) diff --git a/start.py b/start.py index 9934754..9518781 100755 --- a/start.py +++ b/start.py @@ -7,7 +7,7 @@ from threading import Timer import grpc -import ptvsd +import debugpy from getgauge import handlers, logger, processor from getgauge.impl_loader import copy_skel_files from getgauge.messages import services_pb2_grpc as spg @@ -47,12 +47,11 @@ def _handle_detached(): def start(): if environ.get('DEBUGGING'): - ptvsd.enable_attach(address=( - '127.0.0.1', int(environ.get('DEBUG_PORT')))) + debugpy.listen(('127.0.0.1', int(environ.get('DEBUG_PORT')))) print(ATTACH_DEBUGGER_EVENT) t = Timer(int(environ.get("debugger_wait_time", 30)), _handle_detached) t.start() - ptvsd.wait_for_attach() + debugpy.wait_for_client() t.cancel() logger.debug('Starting grpc server..') server = grpc.server(ThreadPoolExecutor(max_workers=1))