-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refatorar testes para não utilizar argumento temp_dir
(problemas com versão pacote click)
#38
Comments
One of the main objectives of dpckan 2º iteration (#15) is the code refactor process. Because of "readability counts" we're trying to follow the PEP 8 style guide for python code or the small_snack_case patter. Function lerDadosJsonMapeado no longer exists so its importations in tests files must be removed Function load_complete_datapackage is imported but needs some tests yet. Resolves: Chunks of #38
As shown in #38, click package version 7.1.2 doesn't have 'temp_dir' argument in isolated_filesystem() function. New click tests documentation: https://click.palletsprojects.com/en/8.0.x/testing/ Old click tests documentation: https://click.palletsprojects.com/en/7.x/testing/ We need to remove this argument and run tests and see the results This commit also changes the old "public" function to the new "create". As said in commit a3158b5, Issue #50 standardized CLI interface commands, that's why we must update its calls inside tests files. It's not the main objective of #38 but to put tests working again these must be corrected. Resolves: Chunks of #38 and related to #50
One of the main objectives of dpckan 2º iteration (#15) is the code refactor process. Because of "readability counts" we're trying to follow the PEP 8 style guide for python code or the small_snack_case patter. Function lerDadosJsonMapeado no longer exists so its importations in tests files must be removed Function load_complete_datapackage is imported but needs some tests yet. Part the clean was made in f07668f but this two was forgotten Resolves: Chunks of #38
temp_dir
(problemas com versão pacote click)
@gabrielbdornas quando for corrigir isso, atualiza também a versão do
que ainda está acontecendo em uma instalação vanilla do frictionless 4.12.2. |
I just released Typer Upgrading Typer should handle the issue. |
Include ipdb package to debug code See #38
@gabrielbdornas estou recebendo os erros abaixo ao rodar os testes. Tem um palpite do que pode ser? $ make tests
Realizando Testes
....EEEE......
======================================================================
ERROR: test_homologa_env (test_dataset_publish_dataset_successfully.TestDatasetPublishDatasetSuccessfully)
Testing dataset publication sucessfully homologacao environment
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/tests/test_dataset_publish_dataset_successfully.py", line 33, in test_homologa_env
delete_dataset(ckan_instance, dataset_name)
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/functions.py", line 68, in delete_dataset
ckan_instance.action.package_delete(id = dataset_name)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/common.py", line 51, in action
return self._ckan.call_action(name, data_dict=kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/remoteckan.py", line 85, in call_action
status, response = self._request_fn(url, data, headers, files, requests_kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/remoteckan.py", line 89, in _request_fn
r = self.session.post(url, data=data, headers=headers, files=files,
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/sessions.py", line 528, in request
prep = self.prepare_request(req)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/sessions.py", line 456, in prepare_request
p.prepare(
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/models.py", line 316, in prepare
self.prepare_url(url, params)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/models.py", line 390, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'dados.mg.gov.br/api/action/package_delete': No schema supplied. Perhaps you meant http://dados.mg.gov.br/api/action/package_delete?
======================================================================
ERROR: test_production_env (test_dataset_publish_dataset_successfully.TestDatasetPublishDatasetSuccessfully)
Testing dataset publication sucessfully production environment
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/tests/test_dataset_publish_dataset_successfully.py", line 55, in test_production_env
delete_dataset(ckan_instance, dataset_name)
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/functions.py", line 68, in delete_dataset
ckan_instance.action.package_delete(id = dataset_name)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/common.py", line 51, in action
return self._ckan.call_action(name, data_dict=kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/remoteckan.py", line 78, in call_action
url = self.address.rstrip('/') + '/' + url
AttributeError: 'NoneType' object has no attribute 'rstrip'
======================================================================
ERROR: test_homologa_env (test_dataset_publish_dataset_with_schema_successfully.TestDatasetPublishDatasetWithSchemaSuccessfully)
Testing dataset publication sucessfully homologacao environment
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/tests/test_dataset_publish_dataset_with_schema_successfully.py", line 33, in test_homologa_env
delete_dataset(ckan_instance, dataset_name)
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/functions.py", line 68, in delete_dataset
ckan_instance.action.package_delete(id = dataset_name)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/common.py", line 51, in action
return self._ckan.call_action(name, data_dict=kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/remoteckan.py", line 85, in call_action
status, response = self._request_fn(url, data, headers, files, requests_kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/remoteckan.py", line 89, in _request_fn
r = self.session.post(url, data=data, headers=headers, files=files,
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/sessions.py", line 528, in request
prep = self.prepare_request(req)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/sessions.py", line 456, in prepare_request
p.prepare(
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/models.py", line 316, in prepare
self.prepare_url(url, params)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/requests/models.py", line 390, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'dados.mg.gov.br/api/action/package_delete': No schema supplied. Perhaps you meant http://dados.mg.gov.br/api/action/package_delete?
======================================================================
ERROR: test_production_env (test_dataset_publish_dataset_with_schema_successfully.TestDatasetPublishDatasetWithSchemaSuccessfully)
Testing dataset publication sucessfully production environment
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/tests/test_dataset_publish_dataset_with_schema_successfully.py", line 55, in test_production_env
delete_dataset(ckan_instance, dataset_name)
File "/Users/fjunior/Local/cge/dados-mg/dpckan/dpckan/functions.py", line 68, in delete_dataset
ckan_instance.action.package_delete(id = dataset_name)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/common.py", line 51, in action
return self._ckan.call_action(name, data_dict=kwargs)
File "/Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/ckanapi/remoteckan.py", line 78, in call_action
url = self.address.rstrip('/') + '/' + url
AttributeError: 'NoneType' object has no attribute 'rstrip'
----------------------------------------------------------------------
Ran 14 tests in 9.283s
FAILED (errors=4)
make: *** [tests] Error 1 |
tldrOs testes passaram quando eu criei as variáveis de ambiente históricoInicialmente eu estava com valores incorretos no arquivo Além disso, mesmo depois de configurar tudo corretamente recebi algumas mensagens de erro que não consegui reproduzir (deixando aqui pra posteridade) $ make tests
Realizando Testes
...../Users/fjunior/.virtualenvs/dpckan/lib/python3.9/site-packages/urllib3/connectionpool.py:938: ResourceWarning: unclosed <ssl.SSLSocket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.0.140', 50027), raddr=('200.198.34.165', 443)>
conn.set_cert(
ResourceWarning: Enable tracemalloc to get the object allocation traceback
.........
----------------------------------------------------------------------
Ran 14 tests in 122.786s
OK Sobre esses testes eu fico com as seguintes impressões
|
@fjuniorr removi os testes para ambientes de produção neste commit, conforme sugerido no final deste comentário |
Devido ao erro apresentado no issue #35 foi necessário passar a versão do pacote click de 8.0.1 para 7.1.2. O problema encontrado foi uma incompatibilidade de versões entre a utilizada no dpckan e versões as necessárias para funcionamento do pacote frictionless e suas dependências.
As versões abaixo de 8 do click não apresentam o parâmetro "temp_dir" para a função isolated_filesystem () o que fez os testes do pacote pararem de funcionar, conforme erro descrito:
Necessário refazer a estrutura dos testes para retirar este parâmetro ou acompanhar a atualização da biblioteca click nos pacotes instalados juntamente com frictionless (para tanto acompanhar esse issue)
The text was updated successfully, but these errors were encountered: