Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9301011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:55:03+00:00 2026-06-18T22:55:03+00:00

Why if I run python manage.py test appname in my terminal is: Ran 0

  • 0

Why if I run python manage.py test appname in my terminal is: Ran 0 tests in 0.000s OK

This is my tests.py:

from django.test import TestCase
import appname.factories

class UserProfileTest(TestCase):
    def sample_data(self):
        for i in range(0, 10):
            user = appname.factories.UserProfileFactory.create()

My models.py:

from django.db import models

class UserProfile(models.Model):
    street = models.CharField(max_length=250)
    tel = models.CharField(max_length=64, default='', blank=True)
    postcode = models.CharField(max_length=250)

    def __unicode__(self):
        return self.tel

My factories.py (factory boy):

from appname.models import *
import factory


class UserProfileFactory(factory.Factory):
    FACTORY_FOR = UserProfile

    street = factory.Sequence(lambda n: 'Street' + n)
    tel = factory.Sequence(lambda n: 'Tel' + n)
    password = 'abcdef'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:55:04+00:00Added an answer on June 18, 2026 at 10:55 pm

    Your individual test functions should begin with the word ‘test’.

    You need to change the function def sample_data(self): to def test_sample_data(self):

    The test runner will look for any classes in a file called tests.py, which sit in the root of your app, and which extend unittest.TestCase. Then it will run any functions within that class which begin with the word test (plus one or two other functions such as setup())

    I’m probably being obtuse, but I couldn’t see anything in the main django testing docs stating that functions must begin with the word test. Anyway, there’s a reference to the requirement in this (official) tutorial.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I run the following command: >python manage.py test Django looks at tests.py in
When I try and run django, this is what I get: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python manage.py runserver
Im trying to write tests for my module. When i run: python manage.py test
How would you run this django command to syncdb with fabric automatically. python manage.py
My test not working. If I try python manage.py test appname I have this
When I try to run python manage.py test in my Django (1.4) project, I
I want to run some Python unit tests from my Maven module. I have
When I run python manage.py dbshell command I get this error: Error: You appear
Is there any free and open-source option to run python from an usb-stick on
I try to use doctest from example from http://docs.python.org/library/doctest.html But when I run python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.