def test_overwrite(): write_to_file(path_combine(testpath.temporary_dir, "overwrite.py"), "def foo(): return 'bar'") dllFile = path_combine(testpath.temporary_dir, "overwrite.dll") clr.CompileModules(dllFile, path_combine(testpath.temporary_dir, "overwrite.py")) write_to_file(path_combine(testpath.temporary_dir, "overwrite1.py"), "def foo(): return 'boo'") clr.CompileModules(dllFile, path_combine(testpath.temporary_dir, "overwrite1.py")) clr.AddReferenceToFileAndPath(dllFile) import overwrite1 AreEqual(overwrite1.foo(), 'boo')
def test_overwrite(self): import clr self.write_to_file(os.path.join(self.temporary_dir, "overwrite.py"), "def foo(): return 'bar'") dllFile = os.path.join(self.temporary_dir, "overwrite.dll") clr.CompileModules(dllFile, os.path.join(self.temporary_dir, "overwrite.py")) self.write_to_file(os.path.join(self.temporary_dir, "overwrite1.py"), "def foo(): return 'boo'") clr.CompileModules(dllFile, os.path.join(self.temporary_dir, "overwrite1.py")) clr.AddReferenceToFileAndPath(dllFile) import overwrite1 self.assertEqual(overwrite1.foo(), 'boo')