我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用site.removeduppaths()。
def test_no_duplicate_paths(self): # No duplicate paths should exist in sys.path # Handled by removeduppaths() site.removeduppaths() seen_paths = set() for path in sys.path: self.assertNotIn(path, seen_paths) seen_paths.add(path)