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

  • Home
  • SEARCH
  • 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 389685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:53:28+00:00 2026-05-12T15:53:28+00:00

nosetest is the default test framework in Turbogeras 2.0. The application has a websetup.py

  • 0

nosetest is the default test framework in Turbogeras 2.0. The application has a websetup.py module that initialise the database. I use mysql for my development and production environment and websetup works fine, but nosetest uses sqlite on memory and when it tries to initialise the DB sends an error:

TypeError: SQLite Date, Time, and
DateTime types only accept Python
datetime objects as input.

I’ve detected when this happens and is in the import fase:

csvreader = csv.reader(open('res/products.csv'), delimiter=",", quotechar="'")
for row in csvreader:
    p = model.Product(row[1], row[2], row[3], row[4] + ".jpg")
    # Even tried to convert the date to a sqlalchemy type
    # need to put a conditional here, when testing I don't care this date
    import sqlalchemy
    dateadded = sqlalchemy.types.DateTime(row[5])
    p.dateAdded = dateadded
    p.brand_id = row[6]
    p.code = row[3]

    ccat = model.DBSession.query(model.Category)\
        .filter(model.Category.id==int(row[8]) + 3).one()

    p.categories.append(ccat)

    p.normalPrice = row[9]
    p.specialPrice = row[10]
    p.discountPrice = row[11]

    model.DBSession.add(p)

How can I tell when nosetest is running? I’ve try:

if globals().has_key('ModelTest'):

and

if vars().has_key('ModelTest'):

The first one with no results and the second one with error

  • 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-05-12T15:53:28+00:00Added an answer on May 12, 2026 at 3:53 pm

    Presumably if nose is running, the ‘nose’ top-level module will have been imported. You should be able to test that with

    if 'nose' in sys.modules:
        print "Nose is running, or at least has been imported!"
        #or whatever you need to do if nose is running
    

    Of course this is not a foolproof test, which assumes that there’s no other reason why nose would be imported.

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

Sidebar

Related Questions

I use nosetests to run my unittests and it works well. I want to
I'm use nosetests to run some tests. However, after the tests have finished running,
I am using nosetests to test several scripts. But when I run nosetests it
I am unable to use nose (nosetests) in a virtualenv project - it can't
I would like to be able to run a nose test script which accepts
This is a slightly.. vain question, but BuildBot's output isn't particularly nice to look
Possible Duplicate: How do you generate dynamic (parameterized) unit tests in Python? Is there
I'm writing quite a few unit tests and using nosetests to run them. Nose
Today I ran a bunch of doctests using Python 2.6 on a Ubuntu 9.10

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.