[migration] put some migration context info in doctest environment: __file__ and __args__ stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Tue, 09 Nov 2010 10:18:56 +0100
branchstable
changeset 6696 160ca95eb4cc
parent 6695 b714521ac66d
child 6697 ffc644fafcb4
[migration] put some migration context info in doctest environment: __file__ and __args__
migration.py
--- a/migration.py	Fri Nov 05 16:55:13 2010 +0100
+++ b/migration.py	Tue Nov 09 10:18:56 2010 +0100
@@ -334,14 +334,15 @@
         if not self.execscript_confirm(migrscript):
             return
         scriptlocals = self._create_context().copy()
+        scriptlocals.update({'__file__': migrscript,
+                             '__args__': kwargs.pop("scriptargs", [])})
         self._context_stack.append(scriptlocals)
         if script_mode == 'python':
             if funcname is None:
                 pyname = '__main__'
             else:
                 pyname = splitext(basename(migrscript))[0]
-            scriptlocals.update({'__file__': migrscript, '__name__': pyname,
-                                 '__args__': kwargs.pop("scriptargs", [])})
+            scriptlocals['__name__'] = pyname
             execfile(migrscript, scriptlocals)
             if funcname is not None:
                 try: