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

Failing Tests #7

Open
wergeld opened this issue Aug 14, 2020 · 3 comments
Open

Failing Tests #7

wergeld opened this issue Aug 14, 2020 · 3 comments

Comments

@wergeld
Copy link

wergeld commented Aug 14, 2020

I am working through the tutorial and I am running into an issue when trying to run the test items (https://www.deploymachinelearning.com/#algorithms-registry). I am getting errors in apps\endpoints\serializers.py:

from apps.endpoints.models import Endpoint
from apps.endpoints.models import MLAlgorithm
from apps.endpoints.models import MLAlgorithmStatus
from apps.endpoints.models import MLRequest

Each of these throws errors that "Unable to import 'apps.endpoints.models'". I can modify such that it looks like:

from .models import Endpoint
from .models import MLAlgorithm
from .models import MLAlgorithmStatus
from .models import MLRequest

I then had to make a similar change in apps\endpoints\views.py.

I am now faced with same issue in apps\ml\registry.py:

from apps.endpoints.models import Endpoint
from apps.endpoints.models import MLAlgorithm
from apps.endpoints.models import MLAlgorithmStatus

This is the output of the test call:
python manage.py test apps.ml.tests

System check identified no issues (0 silenced).
E

ERROR: tests (unittest.loader._FailedTest)

ImportError: Failed to import test module: tests
Traceback (most recent call last):
File "C:\Python\Python38\lib\unittest\loader.py", line 154, in loadTestsFromName
module = import(module_name)
File "C:\Users\lrichards\source\repos\my_ml_service\backend\server\apps\ml\tests.py", line 5, in
from .registry import MLRegistry
File "C:\Users\lrichards\source\repos\my_ml_service\backend\server\apps\ml\registry.py", line 1, in
from endpoints.models import Endpoint
ModuleNotFoundError: No module named 'endpoints'


Ran 1 test in 0.003s

FAILED (errors=1)

I am not really sure how to fix this. I am using the same virtual env I setup and editing just the django code in VS Code. The pylint is not yelling at me anymore but the tests fail. If, for example in registry.py i make line 1 be from apps.endpoints.models import Endpoint it throws very similar error that it cannot find that module.

It seems like there is some sort of relative path thing going on and I cannot seem to figure it out.

System:
Windows 10 Pro
Python 3.8.5 x64
django 2.2.4

@pplonski
Copy link
Owner

Have you tried to add the directory one level higher than apps to PYTHON_PATH?

@wergeld
Copy link
Author

wergeld commented Aug 16, 2020

I am not sure where i would add PYTHON_PATH? I have tried doing something like ..apps.endpoints.models and I got error that I had gone beyond the top level.

I sort of have gotten around this issue on my home computer (versus my work computer) but essentially ignoring anything that pylint says.

@pplonski
Copy link
Owner

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

No branches or pull requests

2 participants