0

I've got the following tests.py file:

from django.test import TestCase
from lxml import etree
import tempfile

import utils

class CreateSurveyFromCsvTextTests(TestCase):

    def parsesSurveyPassedInAsCsvAndReturnsXmlRepresentation(self):
        text = """"survey",,,,,
                ,"name","type","label","hint","required"
                ,"gps","geopoint","Record your current location",,"false"
                ,"start","start",,,
                ,"end","end",,,
                "settings",
                ,"form_title"
                ,"New survey" """

        xml = create_survey_from_csv_text(text)

        lxml.fromstring(xml)

when I run my module with python manage.py test, the output is

Ran 0 tests in 0.000s

I know the runner is picking up the file because if I make an invalid import it throws an error.

Why is the test not being called?

Nicolas Straub
  • 3,381
  • 6
  • 21
  • 42

1 Answers1

1

The name of the test methods need to start with test_. This allows the class to have both test methods and helper methods that you may write as well.

Hence you should rename your method to test_parsesSurveyPassedInAsCsvAndReturnsXmlRepresentation (and perhaps shorten the name too).

Simeon Visser
  • 118,920
  • 18
  • 185
  • 180