I'm currently writing test cases for a web application that was built using Django and has Coverage.py as a means of testing the application. I wrote a number of unit tests to test the models in the models.py but for some reason several of these tests are not running.
Below is an example of the code I have running in a file called "test_models.py" I've also laid out the structure of the application.
-myapp
--apps
--app1
--models.py
--testsuite
--test_models.py
--app2
NOTE: I have all my __init__.py files where they need to be. This is how my test_models.py file looks:
#from django.test import TestCase
# Other imports
Class TestModel(TestCase):
def setUp(self):
# Load in the database.
def test_method_1(self):
# Do some stuff
print("Test1")
def test_method_2(self):
# Do some stuff
print("Test2")
def test_method_3(self):
# Do some stuff
print("Test3")
def test_method_4(self):
# Do some stuff
print("Test4")
def test_method_5(self):
# Do some stuff
print("Test5")
def test_method_6(self):
# Do some stuff
print("Test6")
def test_method_7(self):
# Do some stuff
print("Test7")
def test_method_8(self):
# Do some stuff
print("Test8")
Now here is where I run into the problems. The command that I run to test all of this stuff is:
coverage run manage.py test apps.app1.testsuite
The output of running this command is:
Creating test database for alias 'default'...
Test7
Test2
Test3
Test8
Test1
Ran 5 tests in 17.306s
# More stuff that isn't important
Obviously there are more than 5 tests to be ran here but I can't for the life of me figure out why it's only running those specific 5 tests. Can anyone shine some light on this issue?
Thanks,
Aucun commentaire:
Enregistrer un commentaire