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 8353071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:09:08+00:00 2026-06-09T09:09:08+00:00

I am working on a project in Python, using Git for version control, and

  • 0

I am working on a project in Python, using Git for version control, and I’ve decided it’s time to add a couple of unit tests. However, I’m not sure about the best way to go about this.

I have two main questions: which framework should I use and how should I arrange my tests? For the first, I’m planning to use unittest since it is built in to Python, but if there is a compelling reason to prefer something else I’m open to suggestions. The second is a tougher question, because my code is already somewhat disorganized, with lots of submodules and relative imports. I’m not sure where to fit the testing code. Also, I’d prefer to keep the testing code seperate from everything else if possible. Lastly, I want the tests to be easy to run, preferably with a single commandline command and minimal path setup.

How do large Python projects handle testing? I understand that there is typically an automated system to run tests on all new checkins. How do they do it? What are the best practices for setting up a testing system?

  • 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-09T09:09:09+00:00Added an answer on June 9, 2026 at 9:09 am

    Test framework choosing is mostly about personal preferences, there are some of widespread:

    • unittest — it’s a clone of java’s junit framework, so its syntax not so python-frendly
    • unittest2 — a featured unittest
    • pytest — comprehensive and complicated framework, but its source code is a little scary, so it’s sometimes difficult to find solution if you have any issues
    • nose — it grown from pytest but simpler, maybe its a good idea for you to use nose

    Usual directory structure, for example, is:

    - project
    | - module_name
      | - submodule.py
    | - tests
      | requirements.txt
      | test_submodule.py
    | - requirements.txt
    

    One of best practices is using virtualenv:

     $ virtualenv env  # create virtualenv
     $ env/bin/activate  # activate virtualenv
     $ pip install -r requirements.txt  # install project requirements
     $ pip install -r tests/requirements.txt  # install testing requirements
     $ py.test  # if you use pytest
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project, using Python running on Google App Engine. The project
I'm currently working on a project 'email to voice call'. Using python i'v extracted
I am working on a google app engine project using python. I want to
I'm working on a project, using Python/Django running on a Virtual Private Server, which
I am working on a project in python using pygame and pyro. I can
I'm running into an issue while unit-testing a Python project that I'm working on
I'm working on a project using Python and pyGTK. I have a window whose
I am working on a project using python 2.7.2, sqlalchemy 0.7, unittest, eclipse 3.7.2
I'm looking to store time-based counters using Redis, in a Python project. I want
I've been working on a project using python with OpenGL for a while now.

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.