minor: getbasetemp: dedent, improve assert (#5327)
minor: getbasetemp: dedent, improve assert
This commit is contained in:
commit
5bc3ad8e27
|
@ -60,7 +60,9 @@ class TempPathFactory(object):
|
|||
|
||||
def getbasetemp(self):
|
||||
""" return base temporary directory. """
|
||||
if self._basetemp is None:
|
||||
if self._basetemp is not None:
|
||||
return self._basetemp
|
||||
|
||||
if self._given_basetemp is not None:
|
||||
basetemp = self._given_basetemp
|
||||
ensure_reset_dir(basetemp)
|
||||
|
@ -76,12 +78,10 @@ class TempPathFactory(object):
|
|||
basetemp = make_numbered_dir_with_cleanup(
|
||||
prefix="pytest-", root=rootdir, keep=3, lock_timeout=LOCK_TIMEOUT
|
||||
)
|
||||
assert basetemp is not None
|
||||
assert basetemp is not None, basetemp
|
||||
self._basetemp = t = basetemp
|
||||
self._trace("new basetemp", t)
|
||||
return t
|
||||
else:
|
||||
return self._basetemp
|
||||
|
||||
|
||||
@attr.s
|
||||
|
|
Loading…
Reference in New Issue