def test_module_reuse(self):
    with util.create_modules('_temp') as mapping:
        loader = self.machinery.SourceFileLoader('_temp', mapping['_temp'])
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', DeprecationWarning)
            module = loader.load_module('_temp')
        module_id = id(module)
        module_dict_id = id(module.__dict__)
        with open(mapping['_temp'], 'w') as file:
            file.write('testing_var = 42\n')
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', DeprecationWarning)
            module = loader.load_module('_temp')
        self.assertIn('testing_var', module.__dict__, "'testing_var' not in {0}".format(list(module.__dict__.keys())))
        self.assertEqual(module, sys.modules['_temp'])
        self.assertEqual(id(module), module_id)
        self.assertEqual(id(module.__dict__), module_dict_id)
def test_module_reuse(self):
    with util.create_modules('_temp') as mapping:
        loader = self.machinery.SourceFileLoader('_temp', mapping['_temp'])
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', DeprecationWarning)
            module = loader.load_module('_temp')
        module_id = id(module)
        module_dict_id = id(module.__dict__)
        with open(mapping['_temp'], 'w') as file:
            file.write('testing_var = 42\n')
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', DeprecationWarning)
            module = loader.load_module('_temp')
        self.assertIn('testing_var', module.__dict__, "'testing_var' not in {0}".format(list(module.__dict__.keys())))
        self.assertEqual(module, sys.modules['_temp'])
        self.assertEqual(id(module), module_id)
        self.assertEqual(id(module.__dict__), module_dict_id)