Giter Site home page Giter Site logo

Comments (12)

chadlwilson avatar chadlwilson commented on June 13, 2024

@bockstaller do you think it's possible we might need for gauge-python to have its own special approach here (as you noted gauge-ruby has?)

from gauge.

bockstaller avatar bockstaller commented on June 13, 2024

It might, I'll take a look
@G1-Diep-Duong can you provide the gauge logs from gauge start until after the BdbQuit?
And could you provide the output of running gauge -v ?

from gauge.

bockstaller avatar bockstaller commented on June 13, 2024

I am afraid you are correct @chadlwilson
At least when we want to support pdb.
Currently plugin ships with debugpy as the debugger of choice. Debugpy communicates over a port instead of stdin.

My guess without logs:
Calling pdb.settrace(), runs pdb, pdb looks for stdin, it has no stdin, and then quits.

from gauge.

G1-Diep-Duong avatar G1-Diep-Duong commented on June 13, 2024

It might, I'll take a look @G1-Diep-Duong can you provide the gauge logs from gauge start until after the BdbQuit? And could you provide the output of running gauge -v ?

Here is the info of gauge with gauge -v:

Gauge version: 1.5.6
Plugins

html-report (4.2.0)
python (0.4.1)
screenshot (0.1.0)
spectacle (0.1.4)

Here is the full log when running sample step:
01-11-2023 17:21:52.473 [Gauge] [DEBUG] Created gauge_screenshots_dir at /Users/diep.duongngoc/Documents/Sample/Selenium_Sample/.gauge/screenshots
01-11-2023 17:21:52.475 [Gauge] [DEBUG] Plugin html-report is already installed.
01-11-2023 17:21:52.476 [Gauge] [DEBUG] Plugin python is already installed.
01-11-2023 17:21:52.476 [Gauge] [DEBUG] Parsing started.
01-11-2023 17:21:52.476 [Gauge] [DEBUG] Started concepts parsing.
01-11-2023 17:21:52.488 [Gauge] [DEBUG] 0 concepts parsing completed.
01-11-2023 17:21:52.488 [Gauge] [DEBUG] Started specifications parsing.
01-11-2023 17:21:52.489 [Gauge] [DEBUG] 1 specifications parsing completed.
01-11-2023 17:21:52.489 [Gauge] [DEBUG] Applying tags filter: sample
01-11-2023 17:21:52.489 [Gauge] [DEBUG] The following specifications satisfy filter criteria:
01-11-2023 17:21:52.489 [Gauge] [DEBUG] specs/example.spec
01-11-2023 17:21:52.489 [Gauge] [DEBUG] Parsing completed.
01-11-2023 17:21:52.612 [python] [ERROR] /Users/diep.duongngoc/.gauge/plugins/python/0.4.1/check_and_install_getgauge.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
01-11-2023 17:21:52.612 [python] [ERROR] import pkg_resources
01-11-2023 17:21:52.981 [python] [INFO] Python: 3.9.18
01-11-2023 17:21:52.981 [python] [DEBUG] Loading step implementations from /Users/diep.duongngoc/Documents/Sample/Selenium_Sample/step_impl dirs.
01-11-2023 17:21:52.990 [python] [DEBUG] Starting grpc server..
01-11-2023 17:21:52.992 [Gauge] [DEBUG] Attempting to connect to grpc server at port: 62139
01-11-2023 17:21:52.994 [Gauge] [DEBUG] Successfully made the connection with runner with port: 62139
01-11-2023 17:21:52.994 [Gauge] [DEBUG] Validation started.
01-11-2023 17:21:52.994 [Gauge] [DEBUG] Validation completed.
01-11-2023 17:21:52.994 [Gauge] [DEBUG] Run started
01-11-2023 17:21:52.996 [Gauge] [DEBUG] Starting Html Report plugin
01-11-2023 17:21:53.025 [html-report] [DEBUG] Setting MaxRecvMsgSize = 1024 MB
01-11-2023 17:21:53.025 [Gauge] [DEBUG] Attempting to connect to grpc server at port: 62142
01-11-2023 17:21:53.026 [Gauge] [DEBUG] Successfully made the connection with plugin with port: 62142
01-11-2023 17:21:53.026 [Gauge] [DEBUG] Initialising suite data store.
01-11-2023 17:21:53.039 [Gauge] [INFO] # Getting Started with Gauge
01-11-2023 17:21:53.041 [Gauge] [INFO] ## Search
01-11-2023 17:21:53.042 [Gauge] [DEBUG] * Sample step
01-11-2023 17:21:53.050 [python] [INFO] > /Users/diep.duongngoc/Documents/Sample/Selenium_Sample/step_impl/sample.py(7)sample()
01-11-2023 17:21:53.050 [python] [INFO] -> print("SAMPLE")
01-11-2023 17:21:53.050 [python] [INFO] (Pdb)
01-11-2023 17:21:53.058 [Gauge] [DEBUG] Checking updates...
01-11-2023 17:21:53.067 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/html-report?l=python&p=html-report,python,screenshot,spectacle&o=darwin&a=arm64
01-11-2023 17:21:53.242 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/python?l=python&p=html-report,python,screenshot,spectacle&o=darwin&a=arm64
01-11-2023 17:21:53.281 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/screenshot?l=python&p=html-report,python,screenshot,spectacle&o=darwin&a=arm64
01-11-2023 17:21:53.323 [Gauge] [DEBUG] Downloading https://downloads.gauge.org/plugin/spectacle?l=python&p=html-report,python,screenshot,spectacle&o=darwin&a=arm64
01-11-2023 17:21:53.458 [Gauge] [ERROR]
Failed Step: Sample step
01-11-2023 17:21:53.458 [Gauge] [ERROR] Error Message: Exception occurred
01-11-2023 17:21:53.458 [Gauge] [ERROR] Specification: specs/example.spec:8
01-11-2023 17:21:53.458 [Gauge] [ERROR] Stacktrace:
Traceback (most recent call last):
File "/Users/diep.duongngoc/Library/Python/3.9/lib/python/site-packages/getgauge/executor.py", line 33, in execute_method
step.impl(*params)
File "/Users/diep.duongngoc/Documents/Sample/Selenium_Sample/step_impl/sample.py", line 7, in sample
print("SAMPLE")
File "/Users/diep.duongngoc/Documents/Sample/Selenium_Sample/step_impl/sample.py", line 7, in sample
print("SAMPLE")
File "/opt/homebrew/Cellar/[email protected]/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/bdb.py", line 88, in trace_dispatch
return self.dispatch_line(frame)
File "/opt/homebrew/Cellar/[email protected]/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/bdb.py", line 113, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit
01-11-2023 17:21:53.460 [html-report] [DEBUG] Transformed SuiteResult to report structure
01-11-2023 17:21:53.475 [html-report] [INFO] Successfully generated html-report to => /Users/diep.duongngoc/Documents/Sample/Selenium_Sample/reports/html-report/index.html
01-11-2023 17:21:53.475 [html-report] [DEBUG] Done generating HTML report using theme from /Users/diep.duongngoc/.gauge/plugins/html-report/4.2.0/themes/default
01-11-2023 17:21:53.475 [Gauge] [DEBUG] Sending kill message to Html Report plugin.
01-11-2023 17:21:53.475 [python] [DEBUG] KillProcessrequest received
01-11-2023 17:21:53.476 [Gauge] [INFO] Specifications: 1 executed 0 passed 1 failed 0 skipped
01-11-2023 17:21:53.476 [Gauge] [INFO] Scenarios: 1 executed 0 passed 1 failed 0 skipped
01-11-2023 17:21:53.476 [Gauge] [INFO]
Total time taken: 465ms

from gauge.

bockstaller avatar bockstaller commented on June 13, 2024

Ok, this looks like my suspicion is true.
Can you test if the vscode breakpoints work?

from gauge.

G1-Diep-Duong avatar G1-Diep-Duong commented on June 13, 2024

Can you test if the vscode breakpoints work?

I tried with "Debug Scenario" function, and noticed that this issue did not occur with vscode breakpoints

from gauge.

bockstaller avatar bockstaller commented on June 13, 2024

Does using "Debug Scenario" or using gauge version 1.5.5 solve your immediate problem?

@chadlwilson if this is the case, I would take a look at switching the lsp communication channel away from stdio and revert the stdin change in common instead of introducing more special cases.

from gauge.

G1-Diep-Duong avatar G1-Diep-Duong commented on June 13, 2024

@bockstaller
Yes, of course it solved this issue, but I still prefer to use pdb.set_trace() more than using built_in function "Debug Scenario" because I can use some customized args for executing, e.g gauge run -v -t "sample|udid:emulator-5554", and I don't know how to add these args when running with built_in function "Debug Scenario" =))
Thankz.

from gauge.

chadlwilson avatar chadlwilson commented on June 13, 2024

@chadlwilson if this is the case, I would take a look at switching the lsp communication channel away from stdio and revert the stdin change in common instead of introducing more special cases.

I'm not sure I know enough about LSP to know the right way forward here. Maybe @sriv or @zabil or @haroon-sheikh have an opinion?

from gauge.

sriv avatar sriv commented on June 13, 2024

I am not very well versed in the python stack, but a cursory look tells me that pdb is similar to ruby pry i.e. a CLI debugger that requires stdin to be passed through. I am not sure if we could make gauge-python do what gauge-ruby does, but that is certainly an option.

Short of that, we may need to switch using pipe or socket as jsonrpc transport.

from gauge.

G1-Diep-Duong avatar G1-Diep-Duong commented on June 13, 2024

Manual debugging (outside IDE) confirms the issue persists in v1.6.1. As this is a critical bug, I recommend prioritizing its fix.
image

from gauge.

chadlwilson avatar chadlwilson commented on June 13, 2024

I'm afraid the project doesn't have the necessary contributors and knowledge to prioritise this without further outside help.

I guess we implicitly decided fixing the wider vscode issues with the language server (especially typescript usage) were higher priority than continued confidence in debugging via PDB or other plugins relying on stdio - which is unfortunate, but probably unavoidable given the current maintenance situation. :-(

from gauge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.