-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: 1.7.0
-
Component/s: None
-
None
-
Environment:centos 5.2, python 2.6
-
ALL
Build mongodb, run python buildscripts/smoke.py --continue-on-failure
>>
buildscripts/smoke.py:442: SyntaxWarning: name 'smoke_db_prefix' is used prior to global declaration
global mongod_executable, mongod_port, shell_executable, continue_on_failure, one_mongod_per_test, small_oplog, smoke_db_prefix, test_path
>>
The problem is that it is used here:
parser.add_option('--smoke-db-prefix', dest='smoke_db_prefix', default=smoke_db_prefix,
help="Prefix to use for the mongods' dbpaths ('%default')")
And so 'global smoke_db_prefix' must occur before this. I am not sure what goes in in parser.add_option. I thought that the global declaration would not be needed before this as that should be a read-only use. But I am not a Python guru. The diff for this is:
— buildscripts/smoke.py.b 2010-09-14 09:31:35.000000000 -0700
+++ buildscripts/smoke.py 2010-09-14 09:38:54.000000000 -0700
@@ -406,6 +406,7 @@
return tests
def main():
+ global smoke_db_prefix
parser = OptionParser(usage="usage: smoke.py [OPTIONS] ARGS*")
parser.add_option('--mode', dest='mode', default='suite',
help='If "files", ARGS are filenames; if "suite", ARGS are sets of tests (%default)')
@@ -439,7 +440,7 @@
print tests
- global mongod_executable, mongod_port, shell_executable, continue_on_failure, one_mongod_per_test, small_oplog, smoke_db_prefix, test_path
+ global mongod_executable, mongod_port, shell_executable, continue_on_failure, one_mongod_per_test, small_oplog, test_path
test_path = options.test_path
mongod_executable = options.mongod_executable
mongod_port = options.mongod_port