~washort/exocet/katamari

« back to all changes in this revision

Viewing changes to exocet/test/test_exocet.py

  • Committer: Allen Short
  • Date: 2011-08-07 18:45:05 UTC
  • Revision ID: washort@divmod.com-20110807184505-phqwsy9tkqdshccu
reify module loading environment and keep in a stack

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
        The L{pep302Mapper} looks up modules by invoking __import__.
121
121
        """
122
122
        import exocet, exocet.test, compiler.visitor
123
 
        pep302Mapper._oldSysModules = sys.modules.copy()
 
123
        exocet._exocet.environmentStack.append(
 
124
            exocet._exocet.PythonModuleEnvironment(
 
125
                sys.modules, sys.meta_path, __builtins__['__import__']))
124
126
        verifyObject(IMapper, pep302Mapper)
125
127
        for (name, mod) in {"sys": sys,
126
128
                            "exocet": exocet,
132
134
        self.assertRaises(ImportError, pep302Mapper.lookup,
133
135
                          "exocet._nonexistentModule")
134
136
 
135
 
 
136
137
    def test_overrides(self):
137
138
        """
138
139
        The L{pep302Mapper} supports overriding its mappings with a dict.