Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Debugger under VS goes to a python algorithm Init but can not enter exec routine #11150

Closed
abuts opened this issue Oct 6, 2014 · 1 comment
Assignees

Comments

@abuts
Copy link
Member

abuts commented Oct 6, 2014

This issue was originally TRAC 10308

Tested on windows machine with powder reduction test provided below but suspected general thing.

When running the system test below using Visual Studio python debugger, one can set up and hit break point in PyInit module of SNSPowderReduction workflow algorithm but can not enter PyExec module of the same algorithm

Tested script


'''
This is provided for testing purposes. It allows you to run the single system test
within Mantid environment
It can be useful for debugging because the errors do not alway 'get out' of
the sub-process used for running the tests in the regular way
'''
from mantid.simpleapi import *
from mantid import config
import sys
import os
import inspect

this_dir = sys.path[0]
print "Script resides in : ",this_dir
#python directories
os.chdir(r'd:\Data\MantidSystemTests\SystemTests')
stressmodule_dir = r'd:\Data\MantidSystemTests\StressTestFramework'
tests_dir = r'd:/Data/MantidSystemTests/SystemTests/AnalysisTests'


sys.path.insert(0,tests_dir)
sys.path.append(stressmodule_dir)


#data_dir1='C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Test/systemtests/Data/SANS2D'
#data_dir2=''C:/Backup/Backup_folder1/work/code/Mantid/git/mantid/Test/systemtests/Data/LOQ'

maps_dir = 'd:/Data/MantidSystemTests/Data'
#data_dir ='d:/Data/isis/Let/June2013'
data_dir ='d:/Data/Mantid_Testing/14_10_02'
#data_dir =maps_dir
#data_dir = 'd:/ttData'
ref_data_dir = 'd:/Data/MantidSystemTests/SystemTests/AnalysisTests/ReferenceResults' 
config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,maps_dir,ref_data_dir))

config['defaultsave.directory'] = data_dir # folder to save resulting spe/nxspe files. Defaults are in




# Find these first
modlToRun = ['SNSPowderRedux'] #['CNCSReductionTest'] #
testToRun =  ['SeriesAndConjoinFilesTest'] #['CNCSReductionTest']




for mod_name in modlToRun:

    module = __import__(mod_name )
    reload(module)
    clear_test_list = False;
    if len(testToRun) == 0:
        clear_test_list = True;
        for name,class_inst in inspect.getmembers(module):
            if inspect.isclass(class_inst):
                if name.endswith('Test'):
                    testToRun.append(name);
                #if hasattr(class_inst, 'runTest') and callable(getattr(class_inst, 'runTest')) and not hasattr(class_inst, "__abstractmethods__"):
                #    testToRun.append(name);
    #reload(sys.modules['isis_reduction_steps'])

    for className in testToRun:
        try:
            testClass = getattr(module, className)()
            testClass.execute()
        except:
            exc_type, exc_value, exc_traceback = sys.exc_info();
            print 'Test: {0} thrown exception: {1} '.format(className,exc_type);
            print 'Reason: {0}'.format(exc_value);
        #os.chdir(this_dir)
        #raise

        outcome = testClass.doValidation()
        print 'Test result: ' + str(outcome)

    if clear_test_list:
        testToRun=[];

os.chdir(this_dir)

@DavidFair
Copy link
Contributor

This is a tooling limitation, since PyExec effectively is in a different thread the debugger isn't attached to

I'm going to close this issue as it's something we can't really fix (since it's the IDEs hook that needs to change)

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

No branches or pull requests

3 participants