Search code examples
pythontestcase

Python A part of code is not being executed


I have this class which gives me output of "I am in level 1" but doesn't out "I am in level 2" so I assume get_full_name(self) part isn't being executed any help?

class UserTest(TestCase):

    user = UserFactory()

    def test_user_login_client(self):
        self.client.login(username=self.user.email, password=self.user.password)
        print "I am in level 1"

    def get_full_name(self):
        print "I am in level 2"
        full_name = user.full_name()

        return full_name

Solution

  • The convention is to prefix the test functions with test_

    You need to rename get_full_name to test_get_full_name