TeselaGen / api-client

Teselagen api client
0 stars 1 forks source link

Make some fixes to API client #42

Open juanneilson opened 2 years ago

juanneilson commented 2 years ago

Some methods fail because they are related to specific ids Ex: https://github.com/TeselaGen/api-client/blob/6070f5251b8331f5232f00ededb65856ef650e3e/teselagen/api/tests/test_build_client.py#L314-L330

juanneilson commented 2 years ago

Failures

Test failures ``` =============================================================================== FAILURES ================================================================================ __________________________________________________________ TestBUILDClient.test_get_aliquot_by_id[one_aliquot] __________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 self = , aliquot_id = '13758' def get_aliquot( self, aliquot_id: AliquotID, ) -> AliquotRecord: """This function returns a single aliquot record. Args: aliquot_id (str): The id of the aliquot record you want to retrieve. Returns: AliquotRecord: Aliquot record. Raises: AliquotNotFoundError: If the aliquot record is not found. """ output_aliquot: AliquotRecord | None = None try: url: str = self.aliquot_url.format(str(aliquot_id)) > response: ResponseDict = get( url=url, headers=self.headers, ) teselagen/api/build_client.py:299: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...d9.480nPZ8hj0PhrD1KnWbRJCg7km-ipbP2ppedFTCwMHc'}, 'url': 'https://platform.teselagen.com/build/cli-api/aliquots/13758'} url = 'https://platform.teselagen.com/build/cli-api/aliquots/13758' def wrapper(**kwargs: Any) -> Union[ParsedJSONResponse, Dict[str, Any]]: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs['url'] > response: requests.Response = func(**kwargs) teselagen/utils/utils.py:362: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...X0NSRUFUT1IiLCJNRU1CRVIiXSwiaWF0IjoxNjUwNDg0OTk3LCJleHAiOjE2NTA0ODY3OTd9.480nPZ8hj0PhrD1KnWbRJCg7km-ipbP2ppedFTCwMHc'}} url = 'https://platform.teselagen.com/build/cli-api/aliquots/13758', response = def wrapper(**kwargs: Any) -> requests.Response: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs.pop('url') try: response: requests.Response = func(url, **kwargs) if response.ok: return response elif response.status_code == 400: resp = json.loads(response.content) raise Exception(f"{response.reason}: {resp['error']}") elif response.status_code == 401: raise Exception(f'URL : {url} access is unauthorized.') elif response.status_code == 404: > raise Exception(f'URL : {url} cannot be found.') E Exception: URL : https://platform.teselagen.com/build/cli-api/aliquots/13758 cannot be found. teselagen/utils/utils.py:337: Exception The above exception was the direct cause of the following exception: self = , aliquot_id = '13758' logged_build_client = @pytest.mark.parametrize( 'aliquot_id', [ '13758', # Lab Group: Common '13760', # Lab Group: Common ], ids=[ 'one_aliquot', 'another_aliquot', ], ) def test_get_aliquot_by_id( self, aliquot_id: str, logged_build_client: BUILDClient, ) -> None: """Test getting aliquots by id.""" client = logged_build_client > response = client.get_aliquot(aliquot_id=aliquot_id) teselagen/api/tests/test_build_client.py:334: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , aliquot_id = '13758' def get_aliquot( self, aliquot_id: AliquotID, ) -> AliquotRecord: """This function returns a single aliquot record. Args: aliquot_id (str): The id of the aliquot record you want to retrieve. Returns: AliquotRecord: Aliquot record. Raises: AliquotNotFoundError: If the aliquot record is not found. """ output_aliquot: AliquotRecord | None = None try: url: str = self.aliquot_url.format(str(aliquot_id)) response: ResponseDict = get( url=url, headers=self.headers, ) assert response['content'] is not None # noqa: S101 output_aliquot = cast(AliquotRecord, json.loads(response['content'])) except Exception as _exc: # fallback to bruteforce if an error occurs # NOTE: Since when using a method to get a single record, the user only have control over the id parameter, # we can't use the same parameters as for the method to get many records. So, we choose to use the # default parameters for the method to get many records. # Except for the `gqlFilter` parameter, which is used for efficient querying. get_records = wrapped_partial(self.get_aliquots, gqlFilter=json.dumps({'id': str(aliquot_id)})) output_aliquot = get_record( get_records=get_records, record_id=aliquot_id, ) if output_aliquot is None: > raise AliquotNotFoundError(f'Aliquot {aliquot_id} not found.') from _exc E teselagen.api.build_client.AliquotNotFoundError: Aliquot 13758 not found. teselagen/api/build_client.py:321: AliquotNotFoundError ------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------- Connection Accepted at https://platform.teselagen.com Selected Lab: Common ----------------------------------------------------------------------- Captured stdout teardown ------------------------------------------------------------------------ Connection Accepted at https://platform.teselagen.com ________________________________________________________ TestBUILDClient.test_get_aliquot_by_id[another_aliquot] ________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 self = , aliquot_id = '13760' def get_aliquot( self, aliquot_id: AliquotID, ) -> AliquotRecord: """This function returns a single aliquot record. Args: aliquot_id (str): The id of the aliquot record you want to retrieve. Returns: AliquotRecord: Aliquot record. Raises: AliquotNotFoundError: If the aliquot record is not found. """ output_aliquot: AliquotRecord | None = None try: url: str = self.aliquot_url.format(str(aliquot_id)) > response: ResponseDict = get( url=url, headers=self.headers, ) teselagen/api/build_client.py:299: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...F9.ChtLr34NYtOLvqt7s4yPWoIxf49UFIrgG0kAtNaHy4o'}, 'url': 'https://platform.teselagen.com/build/cli-api/aliquots/13760'} url = 'https://platform.teselagen.com/build/cli-api/aliquots/13760' def wrapper(**kwargs: Any) -> Union[ParsedJSONResponse, Dict[str, Any]]: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs['url'] > response: requests.Response = func(**kwargs) teselagen/utils/utils.py:362: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...X0NSRUFUT1IiLCJNRU1CRVIiXSwiaWF0IjoxNjUwNDg1MDAxLCJleHAiOjE2NTA0ODY4MDF9.ChtLr34NYtOLvqt7s4yPWoIxf49UFIrgG0kAtNaHy4o'}} url = 'https://platform.teselagen.com/build/cli-api/aliquots/13760', response = def wrapper(**kwargs: Any) -> requests.Response: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs.pop('url') try: response: requests.Response = func(url, **kwargs) if response.ok: return response elif response.status_code == 400: resp = json.loads(response.content) raise Exception(f"{response.reason}: {resp['error']}") elif response.status_code == 401: raise Exception(f'URL : {url} access is unauthorized.') elif response.status_code == 404: > raise Exception(f'URL : {url} cannot be found.') E Exception: URL : https://platform.teselagen.com/build/cli-api/aliquots/13760 cannot be found. teselagen/utils/utils.py:337: Exception The above exception was the direct cause of the following exception: self = , aliquot_id = '13760' logged_build_client = @pytest.mark.parametrize( 'aliquot_id', [ '13758', # Lab Group: Common '13760', # Lab Group: Common ], ids=[ 'one_aliquot', 'another_aliquot', ], ) def test_get_aliquot_by_id( self, aliquot_id: str, logged_build_client: BUILDClient, ) -> None: """Test getting aliquots by id.""" client = logged_build_client > response = client.get_aliquot(aliquot_id=aliquot_id) teselagen/api/tests/test_build_client.py:334: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , aliquot_id = '13760' def get_aliquot( self, aliquot_id: AliquotID, ) -> AliquotRecord: """This function returns a single aliquot record. Args: aliquot_id (str): The id of the aliquot record you want to retrieve. Returns: AliquotRecord: Aliquot record. Raises: AliquotNotFoundError: If the aliquot record is not found. """ output_aliquot: AliquotRecord | None = None try: url: str = self.aliquot_url.format(str(aliquot_id)) response: ResponseDict = get( url=url, headers=self.headers, ) assert response['content'] is not None # noqa: S101 output_aliquot = cast(AliquotRecord, json.loads(response['content'])) except Exception as _exc: # fallback to bruteforce if an error occurs # NOTE: Since when using a method to get a single record, the user only have control over the id parameter, # we can't use the same parameters as for the method to get many records. So, we choose to use the # default parameters for the method to get many records. # Except for the `gqlFilter` parameter, which is used for efficient querying. get_records = wrapped_partial(self.get_aliquots, gqlFilter=json.dumps({'id': str(aliquot_id)})) output_aliquot = get_record( get_records=get_records, record_id=aliquot_id, ) if output_aliquot is None: > raise AliquotNotFoundError(f'Aliquot {aliquot_id} not found.') from _exc E teselagen.api.build_client.AliquotNotFoundError: Aliquot 13760 not found. teselagen/api/build_client.py:321: AliquotNotFoundError ------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------- Connection Accepted at https://platform.teselagen.com Selected Lab: Common ----------------------------------------------------------------------- Captured stdout teardown ------------------------------------------------------------------------ Connection Accepted at https://platform.teselagen.com ___________________________________________________________ TestBUILDClient.test_get_sample_by_id[one_sample] ___________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 self = , sample_id = '19152' def get_sample( self, sample_id: SampleID, ) -> SampleRecord: """This function returns a single sample by id. Args: sample_id (SampleID): The id of the sample to return. Returns: SampleRecord: Sample record. Raises: SampleNotFoundError: If the sample record is not found. """ output_sample: SampleRecord | None = None try: url: str = self.sample_url.format(str(sample_id)) > response: ResponseDict = get( url=url, headers=self.headers, ) teselagen/api/build_client.py:394: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...jV9.gLOIGeDjw-Le-lb5dkEW-LpFv1gWDfhBRyR6JtzNveY'}, 'url': 'https://platform.teselagen.com/build/cli-api/samples/19152'} url = 'https://platform.teselagen.com/build/cli-api/samples/19152' def wrapper(**kwargs: Any) -> Union[ParsedJSONResponse, Dict[str, Any]]: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs['url'] > response: requests.Response = func(**kwargs) teselagen/utils/utils.py:362: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...X0NSRUFUT1IiLCJNRU1CRVIiXSwiaWF0IjoxNjUwNDg1MDI1LCJleHAiOjE2NTA0ODY4MjV9.gLOIGeDjw-Le-lb5dkEW-LpFv1gWDfhBRyR6JtzNveY'}} url = 'https://platform.teselagen.com/build/cli-api/samples/19152', response = def wrapper(**kwargs: Any) -> requests.Response: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs.pop('url') try: response: requests.Response = func(url, **kwargs) if response.ok: return response elif response.status_code == 400: resp = json.loads(response.content) raise Exception(f"{response.reason}: {resp['error']}") elif response.status_code == 401: raise Exception(f'URL : {url} access is unauthorized.') elif response.status_code == 404: > raise Exception(f'URL : {url} cannot be found.') E Exception: URL : https://platform.teselagen.com/build/cli-api/samples/19152 cannot be found. teselagen/utils/utils.py:337: Exception The above exception was the direct cause of the following exception: self = , sample_id = '19152' logged_build_client = @pytest.mark.parametrize( 'sample_id', [ '19152', # Lab Group: Common '16457', # Lab Group: Common ], ids=[ 'one_sample', 'another_sample', ], ) def test_get_sample_by_id( self, sample_id: str, logged_build_client: BUILDClient, ) -> None: """Test getting samples by id.""" client = logged_build_client > response = client.get_sample(sample_id=sample_id) teselagen/api/tests/test_build_client.py:403: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , sample_id = '19152' def get_sample( self, sample_id: SampleID, ) -> SampleRecord: """This function returns a single sample by id. Args: sample_id (SampleID): The id of the sample to return. Returns: SampleRecord: Sample record. Raises: SampleNotFoundError: If the sample record is not found. """ output_sample: SampleRecord | None = None try: url: str = self.sample_url.format(str(sample_id)) response: ResponseDict = get( url=url, headers=self.headers, ) assert response['content'] is not None # noqa: S101 output_sample = cast(SampleRecord, json.loads(response['content'])) except Exception as _exc: # fallback to bruteforce if an error occurs # NOTE: Since when using a method to get a single record, the user only have control over the id parameter, # we can't use the same parameters as for the method to get many records. So, we choose to use the # default parameters for the method to get many records. # Except for the `gqlFilter` parameter, which is used for efficient querying. get_records = wrapped_partial(self.get_samples, gqlFilter=json.dumps({'id': str(sample_id)})) output_sample = get_record( get_records=get_records, record_id=sample_id, ) if output_sample is None: > raise SampleNotFoundError(f'Sample {sample_id} not found.') from _exc E teselagen.api.build_client.SampleNotFoundError: Sample 19152 not found. teselagen/api/build_client.py:416: SampleNotFoundError ------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------- Connection Accepted at https://platform.teselagen.com Selected Lab: Common ----------------------------------------------------------------------- Captured stdout teardown ------------------------------------------------------------------------ Connection Accepted at https://platform.teselagen.com _________________________________________________________ TestBUILDClient.test_get_sample_by_id[another_sample] _________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 self = , sample_id = '16457' def get_sample( self, sample_id: SampleID, ) -> SampleRecord: """This function returns a single sample by id. Args: sample_id (SampleID): The id of the sample to return. Returns: SampleRecord: Sample record. Raises: SampleNotFoundError: If the sample record is not found. """ output_sample: SampleRecord | None = None try: url: str = self.sample_url.format(str(sample_id)) > response: ResponseDict = get( url=url, headers=self.headers, ) teselagen/api/build_client.py:394: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...zB9.WHQCJ0y7sOfhryufd70jKUWSwsWtnnrUEE4KFqo4fJQ'}, 'url': 'https://platform.teselagen.com/build/cli-api/samples/16457'} url = 'https://platform.teselagen.com/build/cli-api/samples/16457' def wrapper(**kwargs: Any) -> Union[ParsedJSONResponse, Dict[str, Any]]: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs['url'] > response: requests.Response = func(**kwargs) teselagen/utils/utils.py:362: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ kwargs = {'headers': {'Content-Type': 'application/json', 'x-tg-cli-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uI...X0NSRUFUT1IiLCJNRU1CRVIiXSwiaWF0IjoxNjUwNDg1MDMwLCJleHAiOjE2NTA0ODY4MzB9.WHQCJ0y7sOfhryufd70jKUWSwsWtnnrUEE4KFqo4fJQ'}} url = 'https://platform.teselagen.com/build/cli-api/samples/16457', response = def wrapper(**kwargs: Any) -> requests.Response: if 'url' not in kwargs.keys(): raise Exception('url MUST be specified as keyword argument') url: str = kwargs.pop('url') try: response: requests.Response = func(url, **kwargs) if response.ok: return response elif response.status_code == 400: resp = json.loads(response.content) raise Exception(f"{response.reason}: {resp['error']}") elif response.status_code == 401: raise Exception(f'URL : {url} access is unauthorized.') elif response.status_code == 404: > raise Exception(f'URL : {url} cannot be found.') E Exception: URL : https://platform.teselagen.com/build/cli-api/samples/16457 cannot be found. teselagen/utils/utils.py:337: Exception The above exception was the direct cause of the following exception: self = , sample_id = '16457' logged_build_client = @pytest.mark.parametrize( 'sample_id', [ '19152', # Lab Group: Common '16457', # Lab Group: Common ], ids=[ 'one_sample', 'another_sample', ], ) def test_get_sample_by_id( self, sample_id: str, logged_build_client: BUILDClient, ) -> None: """Test getting samples by id.""" client = logged_build_client > response = client.get_sample(sample_id=sample_id) teselagen/api/tests/test_build_client.py:403: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , sample_id = '16457' def get_sample( self, sample_id: SampleID, ) -> SampleRecord: """This function returns a single sample by id. Args: sample_id (SampleID): The id of the sample to return. Returns: SampleRecord: Sample record. Raises: SampleNotFoundError: If the sample record is not found. """ output_sample: SampleRecord | None = None try: url: str = self.sample_url.format(str(sample_id)) response: ResponseDict = get( url=url, headers=self.headers, ) assert response['content'] is not None # noqa: S101 output_sample = cast(SampleRecord, json.loads(response['content'])) except Exception as _exc: # fallback to bruteforce if an error occurs # NOTE: Since when using a method to get a single record, the user only have control over the id parameter, # we can't use the same parameters as for the method to get many records. So, we choose to use the # default parameters for the method to get many records. # Except for the `gqlFilter` parameter, which is used for efficient querying. get_records = wrapped_partial(self.get_samples, gqlFilter=json.dumps({'id': str(sample_id)})) output_sample = get_record( get_records=get_records, record_id=sample_id, ) if output_sample is None: > raise SampleNotFoundError(f'Sample {sample_id} not found.') from _exc E teselagen.api.build_client.SampleNotFoundError: Sample 16457 not found. teselagen/api/build_client.py:416: SampleNotFoundError ------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------- Connection Accepted at https://platform.teselagen.com Selected Lab: Common ----------------------------------------------------------------------- Captured stdout teardown ------------------------------------------------------------------------ Connection Accepted at https://platform.teselagen.com __________________________________________________________________ TestTESTClient.test_get_experiments __________________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 self = , logged_client = select_laboratory = None def test_get_experiments( self, logged_client: TeselaGenClient, select_laboratory, ) -> None: client: TESTClient = logged_client.test response = client.get_experiments() assert isinstance(response, list) > assert len(response) > 0 E assert 0 > 0 E + where 0 = len([]) teselagen/api/tests/test_test_client.py:302: AssertionError ------------------------------------------------------------------------- Captured stdout setup ------------------------------------------------------------------------- Connection Accepted at https://platform.teselagen.com Selected Lab: P&G ----------------------------------------------------------------------- Captured stdout teardown ------------------------------------------------------------------------ Connection Accepted at https://platform.teselagen.com ___________________________________________________________ notebook: nbregression(Hello_World_BUILD_module) ____________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 nbconvert.preprocessors.execute.CellExecutionError: An error occurred while executing the following cell: ------------------ list(features) ------------------ --------------------------------------------------------------------------- NameError Traceback (most recent call last) /tmp/ipykernel_85020/715497681.py in ----> 1 list(features) NameError: name 'features' is not defined NameError: name 'features' is not defined ------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------- Diff up to exception: --- expected +++ obtained ___________________________________________________________ notebook: nbregression(Hello_World_DESIGN_module) ___________________________________________________________ [gw0] linux -- Python 3.9.9 /usr/bin/python3 nbconvert.preprocessors.execute.CellExecutionError: An error occurred while executing the following cell: ------------------ # The following list contains a list with the uploaded sequence id ids_list = [int(result['existingAminoAcidSequences'][0]['id'])] result = client.design.export_aa_sequences(ids_list) ------------------ --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /tmp/ipykernel_85183/255074899.py in 1 # The following list contains a list with the uploaded sequence id ----> 2 ids_list = [int(result['existingAminoAcidSequences'][0]['id'])] 3 result = client.design.export_aa_sequences(ids_list) ValueError: invalid literal for int() with base 10: '7b241b27-ddaf-4c8b-b19c-33c5f264a813' ValueError: invalid literal for int() with base 10: '7b241b27-ddaf-4c8b-b19c-33c5f264a813' ------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------- Diff up to exception: --- expected +++ obtained =========================================================================== warnings summary ============================================================================ ../usr/local/lib/python3.9/dist-packages/pytest_notebook/notebook.py:145 /usr/local/lib/python3.9/dist-packages/pytest_notebook/notebook.py:145: DeprecationWarning: read_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice. importlib_resources.read_text(resources, "nb_metadata.schema.json") ../usr/local/lib/python3.9/dist-packages/importlib_resources/_legacy.py:80 /usr/local/lib/python3.9/dist-packages/importlib_resources/_legacy.py:80: DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice. with open_text(package, resource, encoding, errors) as fp: teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_aliquots_with_default_query_params conftest.py:112 conftest.py:112 /home/conftest.py:112: UserWarning: Host URL was set to: https://platform.teselagen.com/ warnings.warn(f"Host URL was set to: {configuration['host_url']}") teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_aliquot_by_id[one_aliquot] teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_aliquot_by_id[another_aliquot] /home/teselagen/api/build_client.py:221: UserWarning: An error occured while calling get_aliquots, fallback to bruteforce. warnings.warn(f'An error occured while calling {get_func_name(get_records)}, fallback to bruteforce.') teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_sample_by_id[one_sample] teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_sample_by_id[another_sample] /home/teselagen/api/build_client.py:221: UserWarning: An error occured while calling get_samples, fallback to bruteforce. warnings.warn(f'An error occured while calling {get_func_name(get_records)}, fallback to bruteforce.') teselagen/examples/pytested/CRISPR-Tool.ipynb: 9 warnings teselagen/examples/pytested/Closing-the-DBTL-Cycle.ipynb: 7 warnings teselagen/examples/pytested/Hello-World-TEST-module.ipynb: 14 warnings teselagen/examples/pytested/Hello_World_BUILD_module.ipynb: 10 warnings teselagen/examples/pytested/Hello_World_DESIGN_module.ipynb: 18 warnings /usr/local/lib/python3.9/dist-packages/jsonschema/validators.py:188: DeprecationWarning: Passing a schema to Validator.iter_errors is deprecated and will be removed in a future release. Call validator.evolve(schema=new_schema).iter_errors(...) instead. warnings.warn( -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================================================================= slowest 10 durations ========================================================================== 252.04s call teselagen/examples/pytested/Hello_World_DESIGN_module.ipynb::nbregression(Hello_World_DESIGN_module) 23.10s call teselagen/examples/pytested/CRISPR-Tool.ipynb::nbregression(CRISPR-Tool) 22.58s call teselagen/api/tests/test_discover_client.py::TestDISCOVERClient::test_design_crispr_grnas 20.22s setup teselagen/api/tests/test_multiomics.py::TestTESTClientMultiomicsData::test_experiment_description_upload 18.96s call teselagen/examples/pytested/Hello_World_BUILD_module.ipynb::nbregression(Hello_World_BUILD_module) 15.41s setup teselagen/api/tests/test_multiomics.py::TestTESTClientMultiomicsData::test_upload_transcriptomics 14.71s setup teselagen/api/tests/test_multiomics.py::TestTESTClientMultiomicsData::test_upload_external_metabolites 13.12s call teselagen/examples/pytested/Hello-World-TEST-module.ipynb::nbregression(Hello-World-TEST-module) 10.11s setup teselagen/api/tests/test_multiomics.py::TestTESTClientMultiomicsData::test_optical_density_upload 10.08s call teselagen/api/tests/test_multiomics.py::TestTESTClientMultiomicsData::test_download_data ======================================================================== short test summary info ======================================================================== SKIPPED [1] teselagen/api/tests/test_client.py:192: Implement Test SKIPPED [1] teselagen/api/tests/test_design_client.py:145: This test should be skipped until we have some way to ensure there is a report in database SKIPPED [1] teselagen/api/tests/test_design_client.py:184: This test should be skipped until we know a dna sequence id in db SKIPPED [1] teselagen/api/tests/test_test_client.py:391: We need to create a test experiment first SKIPPED [1] teselagen/api/tests/test_test_client.py:429: We don't know which experiment and parser IDs to use FAILED teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_aliquot_by_id[one_aliquot] - teselagen.api.build_client.AliquotNotFoundError: Aliquot 13758... FAILED teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_aliquot_by_id[another_aliquot] - teselagen.api.build_client.AliquotNotFoundError: Aliquot 1... FAILED teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_sample_by_id[one_sample] - teselagen.api.build_client.SampleNotFoundError: Sample 19152 not... FAILED teselagen/api/tests/test_build_client.py::TestBUILDClient::test_get_sample_by_id[another_sample] - teselagen.api.build_client.SampleNotFoundError: Sample 16457... FAILED teselagen/api/tests/test_test_client.py::TestTESTClient::test_get_experiments - assert 0 > 0 FAILED teselagen/examples/pytested/Hello_World_BUILD_module.ipynb::nbregression(Hello_World_BUILD_module) FAILED teselagen/examples/pytested/Hello_World_DESIGN_module.ipynb::nbregression(Hello_World_DESIGN_module) ```