def test_get_ccs_version_from_path(self, t_env): answer = t_env['CCS_VERSIONS'][0] path = find_ccs(version=answer) result = get_ccs_version(path) assert result == answer
def test_get_ccs_version_from_path(self, tenv): answer = tenv['ccs']['versions'][0] path = find_ccs(version=answer) result = get_ccs_version(path) assert result == answer
def test_ccsfind_second_version(self, t_env): if len(t_env['CCS_VERSIONS']) < 2: pytest.skip("Need more than one CCS installation to run this test") version = t_env['CCS_VERSIONS'][1] ccs_path = find_ccs(version=version) assert isinstance(ccs_path, str), \ "Could not find ccs version %s installation" \ % version
def __handle_ccs(ccs): """Takes either ccs version number or path to custom ccs installation and verifies and returns the path to the ccs installation Args: ccs (str): version number of CCS to use or path to custom installation Returns: str: returns full path to ccs installation Raises: FindCCSError: raises error if cannot find ccs installation """ ccs_path = None if ccs is None: # Get latest ccs installation ccs_path = find_ccs() else: # Convert any int to str to support backwards-compatibility if type(ccs) is int: ccs = str(ccs) # check if string is version number or a file path try: #TODO: Hacky? Look into better solution int(ccs.replace('.', '')) # Throws error if not a version number ccs_path = find_ccs(version=ccs) except ValueError: if not os.path.exists(ccs): raise FindCCSError("Invalid path to ccs installation: %s" % ccs) else: ccs_path = find_ccs(ccs_prefix=ccs) return ccs_path
def test_ccsfind_first_version(self, t_env): version = t_env['CCS_VERSIONS'][0] ccs_path = find_ccs(version=version) assert isinstance(ccs_path, str), \ "Could not find ccs version %d installation" \ % version
def test_ccsfind_nonexistant_custom_install_using_env_var(self, t_env): os.environ['CCS_PREFIX'] = "/nonexistant/path/to/ccs" with pytest.raises(Exception): ccs_path = find_ccs()
def test_ccsfind_nonexistant_custom_install_using_ccs_prefix_param( self, t_env): ccs_prefix = "/nonexistant/path/to/ccs" with pytest.raises(Exception): ccs_path = find_ccs(ccs_prefix=ccs_prefix)
def test_ccsfind_missing_installation(self, t_env): version = "0.0.0.00009" with pytest.raises(Exception): find_ccs(version=version)
def test_ccsfind_latest_version(self, t_env): latest_ccs_path = find_ccs() version = max(t_env['CCS_VERSIONS']) max_ccs_path = find_ccs(version=version) assert (latest_ccs_path == max_ccs_path)
def test_ccsfind_first_version(self, tenv): version = tenv['ccs']['versions'][0] ccs_path = find_ccs(version=version) assert isinstance(ccs_path, str), \ "Could not find ccs version %d installation" \ % version
def test_ccsfind_latest_version(self, tenv): latest_ccs_path = find_ccs() version = max(tenv['ccs']['versions']) max_ccs_path = find_ccs(version=version) assert (latest_ccs_path == max_ccs_path)