sys.modules.clear

Here are the examples of the python api sys.modules.clear taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

25 Examples 7

Example 1

Project: simian
Source File: sandbox_test.py
View license
  def tearDown(self):
    sys.modules.clear()
    sys.modules.update(self.modules)
    __builtin__.__dict__.update(self.builtins)
    sys.meta_path = self.old_meta_path
    sys.path = self.old_path
    sandbox._THIRD_PARTY_LIBRARY_FORMAT_STRING = self.old_library_format_string
    self.mox.UnsetStubs()
    super(SandboxTest, self).tearDown()

Example 2

View license
  def tearDown(self):
    sys.modules.clear()
    sys.modules.update(self.modules)
    __builtin__.__dict__.update(self.builtins)
    sys.meta_path = self.old_meta_path
    sys.path = self.old_path
    sandbox._THIRD_PARTY_LIBRARY_FORMAT_STRING = self.old_library_format_string
    self.mox.UnsetStubs()
    super(SandboxTest, self).tearDown()

Example 3

Project: mythbox
Source File: test_gtkreactor.py
View license
    def tearDown(self):
        """
        Return sys.modules to the way it was before the test.
        """
        sys.modules.clear()
        sys.modules.update(self.mods)

Example 4

Project: mythbox
Source File: test_gtkreactor.py
View license
    def tearDown(self):
        """
        Return sys.modules to the way it was before the test.
        """
        sys.modules.clear()
        sys.modules.update(self.mods)

Example 5

Project: mythbox
Source File: test_versions.py
View license
    def tearDown(self):
        """
        Remove the imported modules and sys.path modifications.
        """
        sys.modules.clear()
        sys.modules.update(self.preTestModules)
        sys.path.remove(self.entry.path)

Example 6

Project: mythbox
Source File: test_versions.py
View license
    def tearDown(self):
        """
        Remove the imported modules and sys.path modifications.
        """
        sys.modules.clear()
        sys.modules.update(self.preTestModules)
        sys.path.remove(self.entry.path)

Example 7

Project: mythbox
Source File: test_plugin.py
View license
    def unsetEnvironment(self):
        """
        Change the Python environment back to what it was before the test was
        started.
        """
        sys.modules.clear()
        sys.modules.update(self.savedModules)
        sys.path[:] = self.savedPath

Example 8

Project: mythbox
Source File: test_plugin.py
View license
    def unsetEnvironment(self):
        """
        Change the Python environment back to what it was before the test was
        started.
        """
        sys.modules.clear()
        sys.modules.update(self.savedModules)
        sys.path[:] = self.savedPath

Example 9

View license
    def tearDown(self):
        """
        Return sys.modules to the way it was before the test.
        """
        sys.modules.clear()
        sys.modules.update(self.mods)

Example 10

View license
    def tearDown(self):
        """
        Return sys.modules to the way it was before the test.
        """
        sys.modules.clear()
        sys.modules.update(self.mods)

Example 11

View license
    def tearDown(self):
        """
        Remove the imported modules and sys.path modifications.
        """
        sys.modules.clear()
        sys.modules.update(self.preTestModules)
        sys.path.remove(self.entry.path)

Example 12

View license
    def tearDown(self):
        """
        Remove the imported modules and sys.path modifications.
        """
        sys.modules.clear()
        sys.modules.update(self.preTestModules)
        sys.path.remove(self.entry.path)

Example 13

View license
    def unsetEnvironment(self):
        """
        Change the Python environment back to what it was before the test was
        started.
        """
        sys.modules.clear()
        sys.modules.update(self.savedModules)
        sys.path[:] = self.savedPath

Example 14

View license
    def unsetEnvironment(self):
        """
        Change the Python environment back to what it was before the test was
        started.
        """
        sys.modules.clear()
        sys.modules.update(self.savedModules)
        sys.path[:] = self.savedPath

Example 15

Project: xbmc-keymap-editor
Source File: main.py
View license
def main():
    ## load mappings ##
    try:
        setup_keymap_folder()
    except Exception:
        traceback.print_exc()
        utils.rpc('GUI.ShowNotification', title="Keymap Editor",
            message="Failed to remove old keymap file", image='error')
        return

    defaultkeymap = utils.read_keymap(default)
    userkeymap = []
    if os.path.exists(gen_file):
        try:
            userkeymap = utils.read_keymap(gen_file)
        except Exception:
            traceback.print_exc()
            utils.rpc('GUI.ShowNotification', title="Keymap Editor",
                      message="Failed to load keymap file", image='error')
            return

    ## main loop ##
    confirm_discard = False
    while True:
        idx = Dialog().select(tr(30000), [tr(30003), tr(30004), tr(30005)])
        if idx == 0:
            # edit
            editor = Editor(defaultkeymap, userkeymap)
            editor.start()
            confirm_discard = editor.dirty
        elif idx == 1:
            # reset
            confirm_discard = bool(userkeymap)
            userkeymap = []
        elif idx == 2:
            # save
            if os.path.exists(gen_file):
                shutil.copyfile(gen_file, gen_file + ".old")
            utils.write_keymap(userkeymap, gen_file)
            xbmc.executebuiltin("action(reloadkeymaps)")
            break
        elif idx == -1 and confirm_discard:
            if Dialog().yesno(tr(30000), tr(30006)) == 1:
                break
        else:
            break

    sys.modules.clear()

Example 16

Project: TrustRouter
Source File: test_datetime.py
View license
            def tearDown(self, teardown=cls.tearDown):
                teardown(self)
                sys.modules.clear()
                sys.modules.update(self._save_sys_modules)

Example 17

Project: brython
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)

Example 18

Project: apitools
Source File: util_test.py
View license
    def tearDown(self):
        sys.modules.clear()
        sys.modules.update(self.original_modules)

Example 19

Project: protorpc
Source File: util_test.py
View license
  def tearDown(self):
    sys.modules.clear()
    sys.modules.update(self.original_modules)

Example 20

Project: kbengine
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)

Example 21

Project: kbengine
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)

Example 22

Project: iot-utilities
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)

Example 23

Project: iot-utilities
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)

Example 24

Project: iot-utilities
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)

Example 25

Project: iot-utilities
Source File: test_datetime.py
View license
        @classmethod
        def tearDownClass(cls_):
            sys.modules.clear()
            sys.modules.update(cls_._save_sys_modules)