Mercurial > p > roundup > code
diff test/memorydb.py @ 5077:88fc7202f87d
Remove 'import *' statement from test/memorydb.py
It is generally best to avoid 'import *' statements, particularly in
this case where objects in the global namespace are being propagated
through to an execfile(). The construction of the 'vars' variable is a
bit of a hack, but preferable to the alternative. Sometime in the future
it may be a good idea to do away with using execfile() to parse the
schema files.
| author | John Kristensen <john@jerrykan.com> |
|---|---|
| date | Fri, 10 Jun 2016 18:24:47 +1000 |
| parents | dad18ee491a9 |
| children | c0cda00af479 |
line wrap: on
line diff
--- a/test/memorydb.py Fri Jun 10 18:21:50 2016 +1000 +++ b/test/memorydb.py Fri Jun 10 18:24:47 2016 +1000 @@ -2,7 +2,9 @@ ''' import shutil +import os +from roundup import date from roundup import hyperdb from roundup import roundupdb from roundup import security @@ -12,7 +14,6 @@ from roundup.backends import indexer_dbm from roundup.backends import sessions_dbm from roundup.backends import indexer_common -from roundup.hyperdb import * from roundup.support import ensureParentsExist def new_config(debug=False): @@ -32,7 +33,10 @@ # load standard schema schema = os.path.join(os.path.dirname(__file__), '../share/roundup/templates/classic/schema.py') - vars = dict(globals()) + vars = hyperdb.__dict__ + vars['Class'] = Class + vars['FileClass'] = FileClass + vars['IssueClass'] = IssueClass vars['db'] = db execfile(schema, vars) initial_data = os.path.join(os.path.dirname(__file__),
