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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:14:42+00:00 2026-05-11T18:14:42+00:00

Is it possible for the nose unit testing framework to perform tests during the

  • 0

Is it possible for the nose unit testing framework to perform tests during the compilation phase of a module?

In fact, I’d like to test something with the following structure:

x = 123
# [x is used here...]
def test_x():
  assert (x == 123)
del x  # Deleted because I don't want to clutter the module with unnecessary attributes

nosetests tells me that x is undefined, as it apparently runs test_x() after importing the module. Is there a way of having nose perform test during the compilation phase while having the module free unnecessary resources after using them?

  • 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-11T18:14:42+00:00Added an answer on May 11, 2026 at 6:14 pm

    According to nose’s main developer Jason Pellerin, the nose unit testing framework cannot run tests during compilation. This is a potential annoyance if both the module “construction” and the test routines need to access a certain variable (which would be deleted in the absence of tests).

    One option is to discourage the user from using any of these unnecessarily saved variables by prepending “__” to their name (this works also for variables used in class construction: they can be one of these “private” globals).

    Another, perhaps cleaner option is to dedicate a module to the task: this module would contain variables that are shared by the module “itself” (i.e. without tests) and its tests (and that would not have to be shared were it not for the tests).

    The problem with these option is that variables that could be deleted if there were no tests are instead kept in memory, just because it is better for the test code to use them. At least, with the above two options, the user should not be tempted to use these variables, nor should he feel the need to wonder what they are!

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

Sidebar

Ask A Question

Stats

  • Questions 299k
  • Answers 300k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When the power button is pressed, the power manager will… May 13, 2026 at 7:52 pm
  • Editorial Team
    Editorial Team added an answer [self.navigationController popToRootViewControllerAnimated:YES]; Or NO if you don't want it to… May 13, 2026 at 7:52 pm
  • Editorial Team
    Editorial Team added an answer Reading through the answers to the two similar problems below,… May 13, 2026 at 7:52 pm

Related Questions

I'm using Eclipse / PyDev trying to find a way to debug code that
Using WCF in a RESTful way seems great. I’m a big fan of the
Is it possible for the compiler to remove statements used for debugging purposes (such
Is it possible for the terminal to detect ⇧ Shift + Enter↵ or Ctrl

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.