Skip to content
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

Refatoração dos testes #9

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Conversation

cuducos
Copy link
Collaborator

@cuducos cuducos commented Sep 7, 2023

Depends on #7 (commit a8d0257 belong there, but we needed it here in order for tests to pass — once that PR is merged the diff here will be clearer)

Closes #8

Esse PR faz com que os testes passem independente de externalidades:

  • Adiciona pytest para coletar todos os testes (ao invés de especificar um ou mais arquivos de testes)
  • Remove dependência de variáveis de ambiente
  • Remove dependência de API externa, substituindo-a por _mock_s
  • Melhora sintaxe dos testes (por exemplo, evita assertTrue(x == y) preferindo assertEqual(x, y))
  • Evita colocar o objeto (função) testada no setUp
  • Evita testar efeitos colaterais (por exemplo, o teste fogocruzado_signin dependia da lógica de fogocruzado_key)

- tests should not rely that much in envvars
- tests should not rely on external API calls
@FelipeSBarros FelipeSBarros merged commit c6b8c48 into FelipeSBarros:master Sep 8, 2023
@FelipeSBarros
Copy link
Owner

@cuducos acho qeu fiz besteira de fazer o merge...
Só depois de fazer o merge é que testei as mudanças.
ao executar o pytest, tive o seguinte resultado:

================================================================================ short test summary info =================================================================================
FAILED tests/test_crossfire.py::TestSuccessSignin::test_fogocruzado_signin_environment_variable - AttributeError: <function fogocruzado_signin at 0x7ff46356cca0> does not have the attribute 'get_token_fogocruzado'
FAILED tests/test_crossfire.py::TestGetFogoCruzado::test_sucessful_get_fogocruzado - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_city_from_list - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_city_from_string - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_security_agent_from_list - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_security_agent_from_string - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_state_from_list - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_state_from_string - AttributeError: <function get_fogocruzado at 0x7ff46150cf70> does not have the attribute 'extract_data_api'
======================================================================== 8 failed, 5 passed, 20 warnings in 1.87s ========================================================================

@cuducos
Copy link
Collaborator Author

cuducos commented Sep 8, 2023

Qual comando utilizou para executar o pytest? Isso não aparece no trecho que você colou.

@FelipeSBarros
Copy link
Owner

Perdão, falha minha. O resultado veio com muitos erros:

 poetry run pytest
================================================================================== test session starts ===================================================================================
platform linux -- Python 3.10.2, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/felipe/repos/crossfire/Python/crossfire
plugins: env-1.0.1
collected 13 items                                                                                                                                                                       

tests/test_crossfire.py F....F.FFFFFF                                                                                                                                              [100%]

======================================================================================== FAILURES ========================================================================================
_____________________________________________________________ TestSuccessSignin.test_fogocruzado_signin_environment_variable _____________________________________________________________

self = <test_crossfire.TestSuccessSignin testMethod=test_fogocruzado_signin_environment_variable>

    def test_fogocruzado_signin_environment_variable(self):
        """
        assert the parameters passed to fogocruzado_signin enables FOGO_CRUZADO varibale
        in the environment
        """
>       with patch("crossfire.fogocruzado_signin.get_token_fogocruzado") as mock:

tests/test_crossfire.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e17cdf90>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function fogocruzado_signin at 0x7f67e75695a0> does not have the attribute 'get_token_fogocruzado'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
___________________________________________________________________ TestGetFogoCruzado.test_sucessful_get_fogocruzado ____________________________________________________________________

self = <test_crossfire.TestGetFogoCruzado testMethod=test_sucessful_get_fogocruzado>

    def test_sucessful_get_fogocruzado(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:93: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e16d85e0>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
_____________________________________________________________ TestFilterCityFogoCruzado.test_sucessful_filter_city_from_list _____________________________________________________________

self = <test_crossfire.TestFilterCityFogoCruzado testMethod=test_sucessful_filter_city_from_list>

    def test_sucessful_filter_city_from_list(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e17ce6b0>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
____________________________________________________________ TestFilterCityFogoCruzado.test_sucessful_filter_city_from_string ____________________________________________________________

self = <test_crossfire.TestFilterCityFogoCruzado testMethod=test_sucessful_filter_city_from_string>

    def test_sucessful_filter_city_from_string(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:107: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e16da680>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
________________________________________________________ TestFilterCityFogoCruzado.test_sucessful_filter_security_agent_from_list ________________________________________________________

self = <test_crossfire.TestFilterCityFogoCruzado testMethod=test_sucessful_filter_security_agent_from_list>

    def test_sucessful_filter_security_agent_from_list(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:165: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e150caf0>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
_______________________________________________________ TestFilterCityFogoCruzado.test_sucessful_filter_security_agent_from_string _______________________________________________________

self = <test_crossfire.TestFilterCityFogoCruzado testMethod=test_sucessful_filter_security_agent_from_string>

    def test_sucessful_filter_security_agent_from_string(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e1638040>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
____________________________________________________________ TestFilterCityFogoCruzado.test_sucessful_filter_state_from_list _____________________________________________________________

self = <test_crossfire.TestFilterCityFogoCruzado testMethod=test_sucessful_filter_state_from_list>

    def test_sucessful_filter_state_from_list(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e15be4a0>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
___________________________________________________________ TestFilterCityFogoCruzado.test_sucessful_filter_state_from_string ____________________________________________________________

self = <test_crossfire.TestFilterCityFogoCruzado testMethod=test_sucessful_filter_state_from_string>

    def test_sucessful_filter_state_from_string(self):
>       with patch("crossfire.get_fogocruzado.extract_data_api") as mock:

tests/test_crossfire.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f67e150cca0>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'

../../../../.pyenv/versions/3.10.2/lib/python3.10/unittest/mock.py:1410: AttributeError
==================================================================================== warnings summary ====================================================================================
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:18
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:18: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    PANDAS_GE_10 = str(pd.__version__) >= LooseVersion("1.0.0")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/setuptools/_distutils/version.py:345: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:19
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:19: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    PANDAS_GE_11 = str(pd.__version__) >= LooseVersion("1.1.0")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:20
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:20: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    PANDAS_GE_115 = str(pd.__version__) >= LooseVersion("1.1.5")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:21
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:21: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    PANDAS_GE_12 = str(pd.__version__) >= LooseVersion("1.2.0")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:29
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:29: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    SHAPELY_GE_17 = str(shapely.__version__) >= LooseVersion("1.7.0")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:30
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:30: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    SHAPELY_GE_18 = str(shapely.__version__) >= LooseVersion("1.8")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:31
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:31: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    SHAPELY_GE_20 = str(shapely.__version__) >= LooseVersion("2.0")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:153
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:153: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    elif (str(np.__version__) >= LooseVersion("1.21")) and not SHAPELY_GE_20:

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:227
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:227
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:227: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    PYPROJ_LT_3 = LooseVersion(pyproj.__version__) < LooseVersion("3")

../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:228
../../../../.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:228
  /home/felipe/.cache/pypoetry/virtualenvs/crossfire-WqfJa-6U-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:228: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    PYPROJ_GE_31 = LooseVersion(pyproj.__version__) >= LooseVersion("3.1")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================ short test summary info =================================================================================
FAILED tests/test_crossfire.py::TestSuccessSignin::test_fogocruzado_signin_environment_variable - AttributeError: <function fogocruzado_signin at 0x7f67e75695a0> does not have the attribute 'get_token_fogocruzado'
FAILED tests/test_crossfire.py::TestGetFogoCruzado::test_sucessful_get_fogocruzado - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_city_from_list - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_city_from_string - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_security_agent_from_list - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_security_agent_from_string - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_state_from_list - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
FAILED tests/test_crossfire.py::TestFilterCityFogoCruzado::test_sucessful_filter_state_from_string - AttributeError: <function get_fogocruzado at 0x7f67e5455870> does not have the attribute 'extract_data_api'
======================================================================== 8 failed, 5 passed, 20 warnings in 1.65s ========================================================================

@cuducos
Copy link
Collaborator Author

cuducos commented Sep 8, 2023

Que interessante. Lembra daqueles import que falamos que só servem para dar uma melhor UX para quem usa a biblioteca?

Eles estão “confundindo” o módulo de mock!

  • no meu ambiente o módulo de mock entende que crossfire.fogocruzado_signin é o módulo crossfire/fogocruzado_signin.py
  • no teu, ele entende que crossfire.fogocruzado_signin é a função fogocruzado_signin importada em crossfire/__init__.py

Temos que acabar com essa ambiguidade de nomes para grantir que isso não ocorra. Vale a pena abrir outra issue pra isso.

@FelipeSBarros
Copy link
Owner

Issue criada.

@cuducos cuducos mentioned this pull request Sep 14, 2023
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Como rodar os testes?
2 participants