def unit_main(): print "unit_main" parse_our_args() global python_test_name, python_cmd_args, python_cmd_line, python_cmd_ip, python_username # if I remember correctly there was an issue with using sys.argv[0] # under nosetests?. yes, see above. We just duplicate it here although sys.argv[0] might be fine here # Use the top of stack! python_test_name = inspect.stack()[-1][1] python_cmd_args = " ".join(sys.argv[1:]) python_cmd_line = "python %s %s" % (python_test_name, python_cmd_args) python_username = getpass.getuser() # depends on ip_from_cmd_line python_cmd_ip = get_ip_address(ipFromCmdLine=ip_from_cmd_line) # if test was run with nosetests, it wouldn't execute unit_main() so we won't see this # so this is correct, for stuff run with 'python ..." print "\nunit_main. Test: %s command line: %s" % (python_test_name, python_cmd_line) unittest.main()
def unit_main(): # print "unit_main" parse_our_args() global python_test_name, python_cmd_args, python_cmd_line, python_cmd_ip, python_username # if I remember correctly there was an issue with using sys.argv[0] # under nosetests?. # yes, see above. We just duplicate it here although sys.argv[0] might be fine here # Use the top of stack! python_test_name = find_python_test_name() python_cmd_args = " ".join(sys.argv[1:]) python_cmd_line = "python %s %s" % (python_test_name, python_cmd_args) python_username = getpass.getuser() # depends on ip_from_cmd_line python_cmd_ip = get_ip_address(ipFromCmdLine=ip_from_cmd_line) # if test was run with nosetests, it wouldn't execute unit_main() so we won't see this # so this is correct, for stuff run with 'python ..." print "\nunit_main. Test: %s command line: %s" % (python_test_name, python_cmd_line) unittest.main()
def unit_main(): # moved clean_sandbox out of here, because nosetests doesn't execute h2o.unit_main in our tests. # UPDATE: ..is that really true? I'm seeing the above print in the console output runnning # jenkins with nosetests parse_our_args() global python_test_name, python_cmd_args, python_cmd_line, python_cmd_ip, python_username # if I remember correctly there was an issue with using sys.argv[0] # under nosetests?. yes, see above. We just duplicate it here although sys.argv[0] might be fine here python_test_name = inspect.stack()[1][1] python_cmd_args = " ".join(sys.argv[1:]) python_cmd_line = "python %s %s" % (python_test_name, python_cmd_args) python_username = getpass.getuser() # if test was run with nosestests, it wouldn't execute unit_main() so we won't see this # so this is correct, for stuff run with 'python ..." print "\nTest: %s command line: %s" % (python_test_name, python_cmd_line) # depends on ip_from_cmd_line python_cmd_ip = get_ip_address(ipFromCmdLine=ip_from_cmd_line) unittest.main()
random_udp_drop = False force_tcp = False random_seed = None beta_features = True sleep_at_tear_down = False abort_after_import = False clone_cloud_json = None disable_time_stamp = False debug_rest = False long_test_case = False usecloud = None # optionally checks expected size if usecloud is used # None means no check usecloud_size = None python_cmd_ip = get_ip_address(ipFromCmdLine=ip_from_cmd_line) # no command line args if run with just nose python_cmd_args = "" # don't really know what it is if nosetests did some stuff. Should be just the test with no args python_cmd_line = "" python_username = getpass.getuser() # The stack is deeper with nose, compared to command line with python # Walk thru the stack looking for ^test_", since we know tests always start with "test_" # from nose case: # inspect.stack()[2] (<frame object at 0x11e7150>, 'test_speedrf_many_cols_enum.py', 5, '<module>', ['import h2o, h2o_cmd, h2o_hosts, h2o_rf, h2o_gbm\n'], 0) # h2o_sandbox.py has some attempts (commented out) at looking for python test names (logged) in h2o stdout # to serve as marker boundaries for log scraping (instead of incremental line counting) # so good to get this correct (will be used by the h2o_nodes[0].h2o_log_msg() (2/LogAndEcho)
ip_from_cmd_line = None network_from_cmd_line = None config_json = None debugger = False random_udp_drop = False force_tcp = False random_seed = None beta_features = True sleep_at_tear_down = False abort_after_import = False clone_cloud_json = None disable_time_stamp = False debug_rest = False long_test_case = False python_cmd_ip = get_ip_address(ipFromCmdLine=ip_from_cmd_line) # no command line args if run with just nose python_cmd_args = "" # don't really know what it is if nosetests did some stuff. Should be just the test with no args python_cmd_line = "" python_username = getpass.getuser() # The stack is deeper with nose, compared to command line with python # Walk thru the stack looking for ^test_", since we know tests always start with "test_" # from nose case: # inspect.stack()[2] (<frame object at 0x11e7150>, 'test_speedrf_many_cols_enum.py', 5, '<module>', ['import h2o, h2o_cmd, h2o_hosts, h2o_rf, h2o_gbm\n'], 0) python_test_name = "unknown" for s in inspect.stack(): # print s if s[1].startswith('test_') or '/test_' in s[1]: