Open bhgrant8 opened 4 years ago
The error appears to be what is described in this blog post:
https://medium.com/@michal.bock/fix-weird-exceptions-when-running-django-tests-f58def71b59a
Mainly being the author's description here:
Importing the model classes in the init.py file of the models package confuses the test runner when reading this file as for some reason it can’t identify to which app these models belong.
We can test a few of the theories in the guide, but removing the __init__.py
from the models is an option, so it is treated as a simple module
vs. a package.
TEAM NAME: Backend PRIORITY (1-5): P2
P2: This is preventing development
Description of issue
When I attempt to run the
./manage.py test
command within the Docker container to test functionality of our API, I receive an error.Developers as well as our CI/CD Pipeline will need to run tests to be able to ensure code is functional
Error Message/Logs
Reproduction Steps
git clone https://github.com/Pand-Aid/pandaid-api.git
master
branch usinggit branch
git pull master
(should be if you did new clone of repo as described in step 1, but good to confirm)docker-compose up
docker-compose exec web bash
./manage.py test
Expected: Tests run without issue
Actual: I receive an error when running tests
Code Snippets
I run:
./manage.py test
which runs this in the backend:nosetests /code/pandaid-rest-api -s --nologcapture --with-coverage --with-progressive --cover-package=pandaid-rest-api --verbosity=1
As setup here:
https://github.com/Pand-Aid/pandaid-api/blob/655aef3f9adf9b3619ef46240117d21ae988fd55/pandaid-rest-api/config/local.py#L9-L20
Screenshots/GIF
n/a - behavior described through logs and recreation
Priority/Impact
We do want to be able to run tests, so should be fixed within 1-2 days