Ticket #10308 (new)

Opened 6 years ago

Last modified 5 years ago

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

Reported by: Alex Buts Owned by: Martyn Gigg
Priority: major Milestone: Backlog
Component: Python Keywords:
Cc: Blocked By:
Blocking: Tester:

Description

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)

Change History

comment:1 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 11150

Note: See TracTickets for help on using tickets.