def test_expand_symlinks_path_case(self): # Ensures that the resulting path case is fixed on case insensitive file # system. os.symlink('dest', os.path.join(self.cwd, 'link')) os.mkdir(os.path.join(self.cwd, 'Dest')) open(os.path.join(self.cwd, 'Dest', 'file.txt'), 'w').close() result = isolateserver.expand_symlinks(unicode(self.cwd), 'link') self.assertEqual((u'Dest', [u'link']), result) result = isolateserver.expand_symlinks(unicode(self.cwd), 'link/File.txt') self.assertEqual((u'Dest/file.txt', [u'link']), result)
def test_symlink_input_absolute_path(self): # A symlink is outside of the checkout, it should be treated as a normal # directory. # .../src # .../src/out -> .../tmp/foo # .../tmp # .../tmp/foo src = os.path.join(self.cwd, u'src') src_out = os.path.join(src, 'out') tmp = os.path.join(self.cwd, 'tmp') tmp_foo = os.path.join(tmp, 'foo') os.mkdir(src) os.mkdir(tmp) os.mkdir(tmp_foo) # The problem was that it's an absolute path, so it must be considered a # normal directory. os.symlink(tmp, src_out) open(os.path.join(tmp_foo, 'bar.txt'), 'w').close() actual = isolateserver.expand_symlinks(src, u'out/foo/bar.txt') self.assertEqual((u'out/foo/bar.txt', []), actual)