示例#1
0
 def test_rmtree_broken_symlink(self):
     symlink = Path(self.d, "symlink")
     symlink.write_link("broken")
     assert symlink.lexists()
     symlink.rmtree()
     assert not symlink.lexists()
示例#2
0
# noinspection PyArgumentList
print(here.atime())  # Last access time; seconds past epcoh
# noinspection PyArgumentList
print(here.ctime()
      )  # Last permission or ownership modification; windows is creation time;
# noinspection PyArgumentList
print(here.isfile())  # Is a file; symbolic links are followed.
print(here.isdir())  # Is a directory; symbolic links are followed.
# noinspection PyArgumentList
print(here.islink())  # Is a symbolic link
# noinspection PyArgumentList
print(here.ismount()
      )  # Is a mount point; ie the parent is on a different device.
# noinspection PyArgumentList
print(here.exists())  # File exists; symbolic links are followed.
# noinspection PyArgumentList
print(here.lexists())  # Same as exists but symbolic links are not followed.
# noinspection PyArgumentList
print(here.size())  # File size in bytes.
print(Path("/foo").isabsolute())  # Is absolute and not relative path

# Epoch?
print("\n*** gmtime")
print(gmtime(0))

# Stat and lstat
print("\n*** Stat and lstat")
print(here.stat(
))  # File stat object for size, permissions etc. Symbolic links are followed.
print(here.lstat())  # Same as stat  but symbolic links are not followed.
# File Attributes and permissions
print("\n*** File Attributes and permissions")
# noinspection PyArgumentList
print(here.atime())  # Last access time; seconds past epcoh
# noinspection PyArgumentList
print(here.ctime())  # Last permission or ownership modification; windows is creation time;
# noinspection PyArgumentList
print(here.isfile())  # Is a file; symbolic links are followed.
print(here.isdir())  # Is a directory; symbolic links are followed.
# noinspection PyArgumentList
print(here.islink())  # Is a symbolic link
# noinspection PyArgumentList
print(here.ismount())  # Is a mount point; ie the parent is on a different device.
# noinspection PyArgumentList
print(here.exists())  # File exists; symbolic links are followed.
# noinspection PyArgumentList
print(here.lexists())  # Same as exists but symbolic links are not followed.
# noinspection PyArgumentList
print(here.size())  # File size in bytes.
print(Path("/foo").isabsolute())  # Is absolute and not relative path

# Epoch?
print("\n*** gmtime")
print(gmtime(0))


# Stat and lstat
print("\n*** Stat and lstat")
print(here.stat())  # File stat object for size, permissions etc. Symbolic links are followed.
print(here.lstat())  # Same as stat  but symbolic links are not followed.
示例#4
0
 def test_rmtree_broken_symlink(self):
     symlink = Path(self.d, "symlink")
     symlink.write_link("broken")
     assert symlink.lexists()
     symlink.rmtree()
     assert not symlink.lexists()