提交 7f1f4d9e authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Improved script running tests individually to allow batches of tests

上级 040012cc
...@@ -17,12 +17,17 @@ This script performs three tasks: ...@@ -17,12 +17,17 @@ This script performs three tasks:
One reason to use this script is if you are a Windows user, and see errors like One reason to use this script is if you are a Windows user, and see errors like
"Not enough storage is available to process this command" when trying to simply "Not enough storage is available to process this command" when trying to simply
run `nosetests` in your Theano installation directory. run `nosetests` in your Theano installation directory.
By using this script, nosetests is run on each test individually, which is By using this script, nosetests is run on each test individually, which is much
slower but should at least let you run the test suite. slower but should at least let you run the test suite.
Note that this script is experimental and might not actually be running the Note that this script is a work-in-progress and is not fully functional at this
whole test suite (it is suspicious that the first step reports more tests than point: the way some tests are defined in the Theano test-suite seems to confuse
the amount of tests found in the resulting '.noseids' file). nosetests' TestID module, probably leading to not running all tests, as well as
to some unexpected test failures.
You can also provide a single command-line argument, which should be an integer
number N (default = 1), in order to run batches of N tests rather than run tests
one at a time. It will be faster (but may fail under Windows if N is too large).
""" """
...@@ -45,11 +50,28 @@ def main(): ...@@ -45,11 +50,28 @@ def main():
ids = data['ids'] ids = data['ids']
n_tests = len(ids) n_tests = len(ids)
# Run tests. # Run tests.
for test_id in xrange(1, n_tests + 1): n_batch = 1
subprocess.call(['nosetests', '-v', '--with-id', str(test_id)]) if len(sys.argv) >= 2:
# Re-run only failed tests n_batch = int(sys.argv[1])
subprocess.call(['nosetests', '-v', '--failed']) has_error = 0
return 0 for test_id in xrange(1, n_tests + 1, n_batch):
test_range = range(test_id, min(test_id + n_batch, n_tests + 1))
rval = subprocess.call(['nosetests', '-v', '--with-id'] +
map(str, test_range))
has_error += rval
if has_error:
# Re-run only failed tests
print """\
###########################
# RE-RUNNING FAILED TESTS #
###########################"""
subprocess.call(['nosetests', '-v', '--failed'])
return 0
else:
print """\
####################
# ALL TESTS PASSED #
####################"""
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论