Skip to content

Commit

Permalink
_pytest._py.path: remove decorator compat
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Oct 19, 2022
1 parent 4e200fe commit cfcaac5
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/_pytest/_py/path.py
Expand Up @@ -119,30 +119,26 @@ def __div__(self, other):

__truediv__ = __div__ # py3k

@property
def basename(self):
"""basename part of path."""
return self._getbyspec("basename")[0]

basename = property(basename, None, None, basename.__doc__)

@property
def dirname(self):
"""dirname part of path."""
return self._getbyspec("dirname")[0]

dirname = property(dirname, None, None, dirname.__doc__)

@property
def purebasename(self):
"""pure base name of the path."""
return self._getbyspec("purebasename")[0]

purebasename = property(purebasename, None, None, purebasename.__doc__)

@property
def ext(self):
"""extension of the path (including the '.')."""
return self._getbyspec("ext")[0]

ext = property(ext, None, None, ext.__doc__)

def dirpath(self, *args, **kwargs):
"""return the directory path joined with any given path arguments."""
return self.new(basename="").join(*args, **kwargs)
Expand Down Expand Up @@ -1205,6 +1201,7 @@ def sysexec(self, *argv, **popen_opts):
)
return stdout

@classmethod
def sysfind(cls, name, checker=None, paths=None):
"""return a path object found by looking at the systems
underlying PATH specification. If the checker is not None
Expand Down Expand Up @@ -1251,8 +1248,7 @@ def sysfind(cls, name, checker=None, paths=None):
pass
return None

sysfind = classmethod(sysfind)

@classmethod
def _gethomedir(cls):
try:
x = os.environ["HOME"]
Expand All @@ -1263,8 +1259,6 @@ def _gethomedir(cls):
return None
return cls(x)

_gethomedir = classmethod(_gethomedir)

# """
# special class constructors for local filesystem paths
# """
Expand All @@ -1288,6 +1282,7 @@ def mkdtemp(cls, rootdir=None):
rootdir = cls.get_temproot()
return cls(error.checked_call(tempfile.mkdtemp, dir=str(rootdir)))

@classmethod
def make_numbered_dir(
cls, prefix="session-", rootdir=None, keep=3, lock_timeout=172800
): # two days
Expand Down Expand Up @@ -1449,8 +1444,6 @@ def is_garbage(path):

return udir

make_numbered_dir = classmethod(make_numbered_dir)


def copymode(src, dest):
"""copy permission from src to dst."""
Expand Down

0 comments on commit cfcaac5

Please sign in to comment.