okfn-brasil / rosie

🤖 Python application responsible for Serenata de Amor's intelligence
409 stars 60 forks source link

Fix core importing #94

Closed lipemorais closed 7 years ago

lipemorais commented 7 years ago

What is the purpose of this Pull Request? The purpose is fixes the error on classsifiers/__init__.py

➜  rosie git:(master) ✗ docker run rosie test core
E.......E
======================================================================
ERROR: classifiers (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: classifiers
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/unittest/loader.py", line 462, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/local/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/rosie/core/classifiers/__init__.py", line 1, in <module>
    from core.classifiers.invalid_cnpj_cpf_classifier import InvalidCnpjCpfClassifier
ModuleNotFoundError: No module named 'core'

======================================================================
ERROR: tests.test_invalid_cnpj_cpf_classifier (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.test_invalid_cnpj_cpf_classifier
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/local/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/rosie/core/tests/test_invalid_cnpj_cpf_classifier.py", line 6, in <module>
    from rosie.core.classifiers import InvalidCnpjCpfClassifier
  File "/rosie/core/classifiers/__init__.py", line 1, in <module>
    from core.classifiers.invalid_cnpj_cpf_classifier import InvalidCnpjCpfClassifier
ModuleNotFoundError: No module named 'core'

----------------------------------------------------------------------
Ran 9 tests in 0.021s

FAILED (errors=2)

What was done to achieve this purpose? I just added the right path.

How to test if it really works? just run docker build -t rosie . and docker run rosie test.

Who can help reviewing it? @anaschwendler @Irio @cuducos

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling d3bbb0218ec561f75da2886322d74fbe29efd5fe on lipemorais:fix-core-importing into on datasciencebr:master.

lipemorais commented 7 years ago

May we keep Dockerfile changes for another PR?

Sure!

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling 3b6961332d30521a8b675b5eee3981be21aa5aae on lipemorais:fix-core-importing into on datasciencebr:master.

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling 3b6961332d30521a8b675b5eee3981be21aa5aae on lipemorais:fix-core-importing into on datasciencebr:master.

anaschwendler commented 7 years ago

As this PR is simple, I will only show how to run the tests:

  1. Running the tests:
➜  rosie git:(lipemorais-fix-core-importing) docker run rosie python rosie.py test core
..................
----------------------------------------------------------------------
Ran 18 tests in 0.099s

OK