def pytest_xdist_setupnodes(self, config, specs): """ called before any remote node is set up. """ print( "\n\nUsing AnyBodyCon: ", config.getoption("--anybodycon") or get_anybodycon_path(), "\n", )
def anybodycon(request): anybodycon_path = request.config.getoption("--anybodycon") if anybodycon_path == None: anybodycon_path = get_anybodycon_path() if not os.path.isfile(anybodycon_path): raise IOError('Cound not find: {}'.format(anybodycon_path)) console_output = subprocess.check_output([anybodycon_path, '/ni']) ams_version = console_output.splitlines()[2].decode()[23:] return anybodycon_path
def ammr(request): ammr_path = request.config.getoption("--ammr") if ammr_path == 'built-in': ammr_path = os.path.join(os.path.dirname(get_anybodycon_path()),'AMMR') if not os.path.exists(ammr_path): raise IOError('Cound not find: {}'.format(ammr_path)) ammr_version = get_ammr_version(ammr_path) return ammr_path
def pytest_configure(config): anybodycon_path = config.getoption("--anybodycon") if anybodycon_path is None: anybodycon_path = get_anybodycon_path() if not os.path.isfile(anybodycon_path): raise IOError('Cound not find: {}'.format(anybodycon_path)) console_output = subprocess.check_output([anybodycon_path, '/ni']) ams_version = console_output.splitlines()[2].decode()[23:] setattr(config, 'anybodycon_version', ams_version) setattr(config,'anybodycon_path', anybodycon_path)
def configure(self, config): """Configure the AnyTestSession object. This can't be in __init__() since it is instantiated and added to the pytest namespace very early in the pytest startup. """ ammr_path = find_ammr_path( config.getoption("--ammr") or config.rootdir.strpath) self.ammr_version = get_ammr_version(ammr_path) self.ams_path = config.getoption( "--anybodycon") or get_anybodycon_path() self.ams_path = os.path.abspath(self.ams_path) if self.ams_path else "" self.ams_version = anybodycon_version(self.ams_path) major_ammr_ver = 1 if self.ammr_version.startswith("1") else 2 self.bm_constants_map = get_bm_constants(ammr_path=ammr_path, ammr_version=major_ammr_ver)
def configure(self, config): """Configure the AnyTestSession object. This can't be in __init__() since it is instantiated and added to the pytest namespace very early in the pytest startup. """ self.hdf5_save_folder = config.getoption("--anytest-output") # if os.path.exists(self.hdf5_save_folder): # shutil.rmtree(self.hdf5_save_folder, ignore_errors=True) self.save_hdf5_files = config.getoption("--anytest-save") ammr_path = find_ammr_path(config.getoption("--ammr") or config.rootdir.strpath) self.ammr_version = get_ammr_version(ammr_path) self.ams_path = config.getoption("--anybodycon") or get_anybodycon_path() self.ams_path = os.path.abspath(self.ams_path) if self.ams_path else "" self.ams_version = anybodycon_version(self.ams_path) major_ammr_ver = 1 if self.ammr_version.startswith("1") else 2 self.bm_constants_map = get_bm_constants( ammr_path=ammr_path, ammr_version=major_ammr_ver )
def configure(self, config): """Configure the AnyTestSession object. This can't be in __init__() since it is instantiated and added to the pytest namespace very early in the pytest startup. """ self.basefolder = config.getoption("--anytest-storage") if not os.path.exists(self.basefolder): os.makedirs(self.basefolder) self.save = config.getoption("--anytest-save") or config.getoption( "--anytest-autosave") ammr_path = find_ammr_path( config.getoption("--ammr") or config.rootdir.strpath) self.ammr_version = get_ammr_version(ammr_path) self.ams_path = config.getoption( "--anybodycon") or get_anybodycon_path() self.ams_path = os.path.abspath(self.ams_path) if self.ams_path else '' self.ams_version = anybodycon_version(self.ams_path) major_ammr_ver = 1 if self.ammr_version.startswith("1") else 2 self.bm_constants_map = get_bm_constants(ammr_path=ammr_path, ammr_version=major_ammr_ver) self.compare_session = self.get_compare_session(config) self.run_compare_test = bool(self.save or self.compare_session)
def test_get_anybodycon_path(): abc = get_anybodycon_path() assert os.path.exists(abc)