[SERVER-1791] in buildscripts/smoke.py, line 442: SyntaxWarning: name 'smoke_db_prefix' is used prior to global declaration Created: 14/Sep/10  Updated: 12/Jul/16  Resolved: 14/Sep/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.7.0
Fix Version/s: 1.7.1

Type: Bug Priority: Minor - P4
Reporter: Mark Callaghan Assignee: Michael Dirolf
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

centos 5.2, python 2.6


Operating System: ALL
Participants:

 Description   

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


 Comments   
Comment by Michael Dirolf [ 14/Sep/10 ]

already fixed in commit 00adc3d0d5b4c6c63bcc19a76ca346f10278cef6

Generated at Thu Feb 08 02:58:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.