def test(): """ test """ l = open('forces.log', 'w') logger = Logger(sys.stderr, l) check_forces('apbs-forces.out', 'polarforces', 'apolarforces', logger)
def test(): """ test """ lval = open("forces.log", "w") logger = Logger(sys.stderr, lval) check_forces("apbs-forces.out", "polarforces", "apolarforces", logger)
def test(): """ Run the test """ lval = open("energy.log", "w") logger = Logger(sys.stderr, lval) # noqa F841 energy_list = check_energies("actio_stdout.txt") print(energy_list)
def test(): """ Run the test """ l = open('energy.log', 'w') logger = Logger(sys.stderr, l) energy_list = check_energies('actio_stdout.txt') print(energy_list)
def main(): """ Parse command line options and run tests with given options """ parser = OptionParser() # Describes the available options. parser.add_option( "-e", "--executable", dest="executable", type="string", default="apbs", help="Set the apbs executable to FILE", metavar="FILE", ) parser.add_option( "-c", "--test_config", dest="test_config", type="string", default="test_cases.cfg", help="Set the test configuration file to FILE", metavar="FILE", ) parser.add_option( "-t", "--target_test", dest="target_test", type="string", action="append", default=[], help="Set the test to run to TEST", metavar="TEST", ) parser.add_option( "-o", "--ocd", action="store_true", dest="ocd", help="Run APBS in OCD mode", ) parser.add_option( "-l", "--log_file", dest="log_file", type="string", default="test.log", help="Save the test log to FILE.", metavar="FILE", ) parser.add_option( "-b", "--benchmark", action="store_const", const=1, dest="benchmark", help="Perform benchmarking.", ) # Parse the command line and extract option values (options, args) = parser.parse_args() # Messages will go to stdout, log messages will go to the supplied log file message_fd = sys.stderr logfile_fd = sys.stderr # Verify that the log file is writable try: logfile_fd = open(options.log_file, "w") except IOError as err: parser.error( f"Couldn't open log_file {options.log_file}: {err.strerror}") # Set up the logger with the message and log file descriptor logger = Logger(message_fd, logfile_fd) # Read the test cases file config = ConfigParser() config.optionxform = str config.read(options.test_config) # Make sure that the apbs binary can be found binary = test_binary(options.executable, logger) # Get the names of all the test sections to run. test_sections = [] if "all" in options.target_test or options.target_test == []: test_sections = config.sections() print("Testing all sections") else: test_sections = options.target_test print("The following sections will be tested: " + ", ".join(test_sections)) print("=" * 80) # Run each test that has been requested for test_name in test_sections: print("Running tests for " + test_name + " section") # Verify that the test is described in the test cases file if test_name not in config.sections(): print(" " + test_name + " section not found in " + options.test_config) return 1 # Grab the test directory test_directory = config.get(test_name, "input_dir") config.remove_option(test_name, "input_dir") # Check if there is a setup step. test_setup = None try: test_setup = config.get(test_name, "setup") config.remove_option(test_name, "setup") except NoOptionError: pass # Run the test! run_test( binary, config.items(test_name), test_name, test_directory, test_setup, logger, options.ocd, ) return 0
def main(): """ Parse command line options and run tests with given options """ parser = OptionParser() #Describes the available options. parser.add_option( '-c', '--test_config', dest='test_config', type='string', default='test_cases.cfg', help="Set the test configuration file to FILE", metavar="FILE" ) parser.add_option( '-t', '--target_test', dest='target_test', type='string', action='append', default=[], help="Set the test to run to TEST", metavar="TEST" ) parser.add_option( '-o', '--ocd', action='store_true', dest='ocd', help="Run APBS in OCD mode" ) parser.add_option( '-l', '--log_file', dest='log_file', type='string', default='test.log', help="Save the test log to FILE.", metavar="FILE" ) # Parse the command line and extract option values ( options, args ) = parser.parse_args() # Messages will go to stdout, log messages will go to the supplied log file message_fd = sys.stdout logfile_fd = None # Verify that the log file is writable try: logfile_fd = open( options.log_file, 'w' ) except IOError as err: parser.error( "Could't open log_file %s: %s" % ( options.log_file, err.strerror ) ) # Set up the logger with the message and log file descriptor logger = Logger( message_fd, logfile_fd ) # Read the test cases file config = ConfigParser() config.read( options.test_config ) # Make sure that the apbs binary can be found binary = test_binary() if binary == '': parser.error( "Coulnd't detect an apbs binary in the path or local bin directory" ) # Get the names of all the test sections to run. test_sections = [] if 'all' in options.target_test or options.target_test == []: test_sections = config.sections() print "Testing all sections" else: test_sections = options.target_test print "The following sections will be tested: " + ', '.join( test_sections ) print '=' * 80 # Run each test that has been requested for test_name in test_sections: print "Running tests for " + test_name + " section" # Verify that the test is described in the test cases file if test_name not in config.sections(): print " " + test_name + " section not found in " + options.test_config print " skipping..." continue # As each test runs, remove the value so it can't be run twice test_directory = config.get( test_name, 'input_dir' ) config.remove_option( test_name, 'input_dir' ) # Run the test! run_test( binary, config.items( test_name ), test_name, test_directory, logger, options.ocd )