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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:25:06+00:00 2026-05-14T05:25:06+00:00

I have a test suite to perform smoke tests. I have all my script

  • 0

I have a test suite to perform smoke tests. I have all my script stored in various classes but when I try and run the test suite I can’t seem to get it working if it is in a class. The code is below: (a class to call the tests)

from alltests import SmokeTests

class CallTests(SmokeTests):

    def integration(self):

        self.suite()

if __name__ == '__main__':
    run = CallTests()
    run.integration()

And the test suite:

class SmokeTests():

    def suite(self): #Function stores all the modules to be tested 
        modules_to_test = ('external_sanity', 'internal_sanity')
        alltests = unittest.TestSuite()
        for module in map(__import__, modules_to_test):
            alltests.addTest(unittest.findTestCases(module))
        return alltests
if __name__ == '__main__':
    unittest.main(defaultTest='suite')

This output’s an error:
Attribute Error: ‘module’ object has no attribute ‘suite’

So I can see how to call a normal function defined but I’m finding it difficult calling in the suite. In one of the tests the suite is set up like so:

class InternalSanityTestSuite(unittest.TestSuite):

# Tests to be tested by test suite
def makeInternalSanityTestSuite():
    suite = unittest.TestSuite()
    suite.addTest(TestInternalSanity("BasicInternalSanity"))
    suite.addTest(TestInternalSanity("VerifyInternalSanityTestFail"))
    return suite

def suite():
    return unittest.makeSuite(TestInternalSanity)

If I have someSuite() inside the class SmokeTests python cannot find the attribute suite but if I remove the class it work’s. I run this as a script and call in variables into the tests. I do not want to have to run the tests by os.system(‘python tests.py’). I was hoping to call the tests through the class I have like any other function

Can anyone help me with getting this running?

Thanks for any help in advance.

  • 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-14T05:25:07+00:00Added an answer on May 14, 2026 at 5:25 am

    I know this is not the answer, but I’d suggest using library that can use test discovery, like nose or unittest capability from Python 2.7+.

    Possibility to do

    nosetests module.submodule
    

    or

    nosetests module.submodule:TestCase.test_method
    

    is priceless 🙂

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

Sidebar

Related Questions

I have a test suite to perform smoke tests. I have all my script
I have the following layout for my test suite: TestSuite1.cmd: Run my program Check
I have created a Visual Studio 2008 sp1 test suite web test that uploads
I've tryed mylyn but i cant find that feature, if anyone have test mantis
I have a MOSS 2007 test site, its not public facing, instead its on
I have a unit test which contains the following line of code Site.objects.get(name=UnitTest).delete() and
I've got IIS7 installed and have a simple website at: c:/inetpub/wwwroot/testsite I can copy
I have test database and a production database. When developing I of course work
I have a test project using MbUnit and TestDriven.Net. If I right-click on an
I have a test environment for a database that I want to reload with

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.