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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:59:20+00:00 2026-05-16T19:59:20+00:00

I do have several small modules where the tests are inside them and py.test

  • 0

I do have several small modules where the tests are inside them and py.test or nose does not look for them because they do not contain test in their filename.

How can I convince py.test or nose to look for tests inside all python files, recursively – ”’including the ones that do not have test in their filenames”’?

Inside the source files I do keep the standard naming convention: class testSomeName with methods def test_some_name.

If this is not possible, what other solution can I use to obtain the same result.

I do not want to manually create a list of all files containing the test, I want a solution that supports discovery.

  • 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-16T19:59:20+00:00Added an answer on May 16, 2026 at 7:59 pm

    You can also have a look at Nose which will discover tests without having to use a fixed file name convention.

    You can bypass the regexp used to filter files in nose with the following code.
    Create a python module (i.e. my_nosetests.py)

    import nose
    from nose.plugins.base import Plugin
    
    class ExtensionPlugin(Plugin):
    
        name = "ExtensionPlugin"
    
        def options(self, parser, env):
            Plugin.options(self,parser,env)
    
        def configure(self, options, config):
            Plugin.configure(self, options, config)
            self.enabled = True
    
        def wantFile(self, file):
            return file.endswith('.py')
    
        def wantDirectory(self,directory):
            return True
    
        def wantModule(self,file):
            return True
    
    
    if __name__ == '__main__':
        includeDirs = ["-w", ".", ".."]
        nose.main(addplugins=[ExtensionPlugin()], argv=sys.argv.extend(includeDirs))
    

    Now run my_nosetests.py as if you were running nosetests and you should have your tests running. Be aware that you are in fact loading all modules and searching for tests in them. Beware of any side effect of module loading.

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

Sidebar

Related Questions

Suppose I have several small test cases. Easy enough to setup and easy enough
I have several small classes that are in a single file in /app/models, similar
I have spent several days now researching Hibernate and have several small questions about
I have a small website with several PDFs free for download. I use StatCounter
I am working in a small team (3 persons) on several modules (about 10
I have to write several small vertical gradients (on a loop) and so I
I am having an application where I have to send several small data per
I have several small place marks such as 'א,א' 'א,ב'. If we use the
I have several small Visual Studio Projects (C++). And many of these projects have
I have several small classes that are all peers of each other declared and

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.