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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:19:43+00:00 2026-06-14T17:19:43+00:00

We have a large repository containing several Python packages(*). I want scons to run

  • 0

We have a large repository containing several Python packages(*). I want scons to run py.test in each of the sub directories and not from the project root. This is proving rather frustrating. Currently, I have this action with all error checking removed:

def runTests (target = None, source = None, env = None):
    cmd = which(env['TEST_RUNNER'])
    if cmd:
        retCode = True
        for path in env['TEST_DIR_LIST']:
            print 'Doing directory %s:' % (path)
            retCode = retCode and subprocess.call([cmd], cwd=path)
        env.Exit(retCode)

Which I call as in the SConstruct file:

runTestsCmd = env.Command('runTests', None, Action(runTests, "Running tests"))
AlwaysBuild(runTestsCmd)
Alias('test', runTestsCmd)

And in each SConscript file, I have this:

env.Append(TEST_DIR_LIST = ['PackageDirectory'])

What I get is that only one instance of py.test is run. I can see the “Doing directory X” messages but no run of py.test.

Clearly, there is a need to not clone the environment in SConscript or if the env is cloned, making sure that the addition to TEST_DIR_LIST happens on original env.

So, my questions are two fold:

  1. Is this a sensible way of doing what I want?
  2. If it is, What am I doing wrong? If it is not, what should I be doing?

(*) Yes, we are looking at changing this. No, it will not happens soon enough so I do need the above.

  • 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-14T17:19:44+00:00Added an answer on June 14, 2026 at 5:19 pm

    The problem is the line:

    retCode = retCode and subprocess.call([cmd], cwd=path)
    

    subprocess.call returns 0 (which evaluates to False) on success. You need to insert a not or maybe do a proper check like this:

    retcode = subprocess.call([cmd], cwd=path)
    if retcode != 0:
         print ("failed ...")
         break  # or not break if you want to continue anyway
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large CVS repository containing files in ISO-8859-1 and want to convert
I have a large file in my repository that is not text-mergeable and that
Say that I have a rather large repository, and I want to compare two
Let's say I have a fairly large repository containing a number of projects. I
In my current project we have a large repository of content that was originally
I have a project which uses a large library residing in its own repository.
I have set up a remote Mercurial (Hg) repository that holds a large Java
I have large set of flow charts and workflow diagrams. I want to draw
I currently have a large (30K commits) SVN repository that I am in the
I have a huge repository of files and there is a .txt containing a

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.