Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Test Debugger no longer working #98

Closed
danielmaddern opened this issue Mar 12, 2018 · 4 comments
Closed

Test Debugger no longer working #98

danielmaddern opened this issue Mar 12, 2018 · 4 comments
Labels

Comments

@danielmaddern
Copy link
Member

golem run -i works correctly with #97

adding debug() or a import pdb; pdb.set_trace() to a test no longer works, it enters then exits the debugger without stopping.

dbug() log:
INFO:golem:Click Login Button
Entering interactive debug mode
Type exit() to stop

now exiting InteractiveConsole...

pdb log:
13:17:24 INFO Click Login Button
INFO:golem:Click Login Button

/home/daniel/Development/golem/FunctionalTests/projects/OSC/tests/forgot_password.py(19)test()
-> click(forgot_password.forgot_link)
(Pdb)
13:17:27 ERROR An error ocurred:
Traceback (most recent call last):
File "/home/daniel/Development/golem-dm/env/lib/python3.6/site-packages/golem_framework-0.4.5-py3.6.egg/golem/test_runner/test_runner.py", line 122, in run_test
test_module.test(execution.data)
File "/home/daniel/Development/golem/FunctionalTests/projects/OSC/tests/forgot_password.py", line 19, in test
click(forgot_password.forgot_link)
File "/home/daniel/Development/golem/FunctionalTests/projects/OSC/tests/forgot_password.py", line 19, in test
click(forgot_password.forgot_link)
File "/usr/lib/python3.6/bdb.py", line 48, in trace_dispatch
return self.dispatch_line(frame)
File "/usr/lib/python3.6/bdb.py", line 67, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit

@r-roos
Copy link
Member

r-roos commented Mar 28, 2018

@danielmaddern did you also try running interactive debug mode from within a testcase (golem run -i <project> <testcase>) ?

I seem to have no luck to get the shell running (even with the proposed fix from the PR)

golem run -i does work by the way

@r-roos
Copy link
Member

r-roos commented Mar 28, 2018

after some more troubleshooting I am convinced the interactive mode is impacted by 3e36f39 due to the usage of multiprocessing even when executing a single threaded test.

The issue can be reproduced with the following code

import multiprocessing
import code

def worker():
    print('Worker')
    code.interact(banner='Hello')
    return

if __name__ == '__main__':
    p = multiprocessing.Process(target=worker)
    p.start()

In the above example the interactive session is directly closed after executing it.

@danielmaddern
Copy link
Member Author

danielmaddern commented Mar 29, 2018

I think you're right..
the 0.4.5 release should still work.. I'll give it a shot shortly.

Possible fix could be

    if not suite_error:
        if test_execution.interactive and execution['workers'] != 1:
            print('WARNING: to run in debug mode, threads must equal one')
        elif test_execution.interactive and execution['workers'] == 1:
            # run using run_test
        else:
            multiprocess_executor(execution_list, execution['workers'])

@luciano-renzi
Copy link
Member

fixed in 0.4.8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants