title: How do I get my hudson project build to fail on second set of nosetests?
body: <p>I'm relatively new to Hudson, so please forgive me if this is a "duh" question. </p>
  
  <p>I have a project written in python (employing pylons and nosetests) that includes both a server component and a client component. I have function tests set up in both the server hierarchy, and the client hierarchy, to exercise both components. In my build script (a shell script launched from the hudson project configuration page), I run two different nosetests, serially, like so:</p>
  
  <pre><code># Python tests for server
  find $WORKSPACE/server/src/project/tests -iname "*test_*.py" | xargs $NOSETESTS --with-coverage --cover-package=project --cover-html --cover-erase --with-pylons="$PYLONS_INI"
  echo "SERVER TEST EXIT STATUS: $?"
  if [ $? -ne 0 ]; then
      test_status=$test_status+$?
      export TEST_STATUS=$test_status
      exit $?
  fi
  </code></pre>
  
  <p>(Then, after starting up the server)</p>
  
  <pre><code># Python tests for client
  find $WORKSPACE/server/src/project/tests -iname "*test_*.py" | xargs $NOSETESTS --with-coverage --cover-package=projectclient --cover-html --cover-erase --with-pylons="$PYLONS_INI"
  echo "CLIENT TEST EXIT STATUS: $?"
  if [ $? -ne 0 ]; then
      test_status=$test_status+$?
      export TEST_STATUS=$test_status
      exit $?
  fi
  </code></pre>
  
  <p>Then I shut the server down.</p>
  
  <p>The first set of tests (the server tests) always work. If a test fails, the build reports a failure, and the ball turns red. The second set (the client tests), however, never work. If a test fails, the STDOUT reports the failure, and the script shows an exit status of 123, but the build never fails.</p>
  
  <p>I've tried adding <pre>maven.test.failure.ignore=false</pre> to my hudson configuration, based on some other questions I've seen here on stackoverflow, but it doesn't seem to have made a difference. I've tried forcing the script to terminate with an artificial exit value to see if it was even paying attention to the exit value, and that didn't change things. I've also tried moving the client tests above the server tests, to see if there were some reason why hudson only allowed for one set of nosetests, but that didn't seem to change things either.</p>
  
  <p>If anyone has any idea what I might be doing wrong, I'd sure appreciate the help. If you need more information, just let me know.</p>
  
  <p>Thanks!</p>
  
  <p>============================</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I was able to get the second set of tests working like so:</p>
  
  <pre><code>find $WORKSPACE/client/python/src/tests -iname "*test_*.py" | xargs $NOSETESTS --with-coverage --cover-package=projectclient --cover-html --cover-erase --with-pylons="$PYLONS_INI"
  client_test_status=$?
  if [ $client_test_status -ne 0 ]; then
      echo "Client Test Status = $client_test_status"
      exit $client_test_status
  fi
  </code></pre>
  
  <p>However, I did not have to make this change to the SERVER tests. Only the client ones. The server tests still work, and still look like this:</p>
  
  <pre><code>find $WORKSPACE/server/src/project/tests -iname "*test_*.py" | xargs $NOSETESTS --with-coverage --cover-package=project --cover-html --cover-erase --with-pylons="$PYLONS_INI"
  if [ $? -ne 0 ]; then
      exit $?
  fi
  </code></pre>
  
  <p>One hypothesis floating around here, is that there might be an issue with the PIPE swallowing $?, but that doesn't explain why the server tests succeed (at failing), but the client tests do not (unless the $? is captured).</p>