Use os.path.isdir instead of os.path.exists

As suggested during review
This commit is contained in:
Bruno Oliveira 2015-06-17 08:08:03 -03:00
parent 923174718e
commit 2653024409
2 changed files with 2 additions and 2 deletions

View File

@ -206,7 +206,7 @@ class LogXML(object):
def pytest_sessionfinish(self):
dirname = os.path.dirname(os.path.abspath(self.logfile))
if not os.path.exists(dirname):
if not os.path.isdir(dirname):
os.makedirs(dirname)
logfile = open(self.logfile, 'w', encoding='utf-8')
suite_stop_time = time.time()

View File

@ -16,7 +16,7 @@ def pytest_configure(config):
# prevent opening resultlog on slave nodes (xdist)
if resultlog and not hasattr(config, 'slaveinput'):
dirname = os.path.dirname(os.path.abspath(resultlog))
if not os.path.exists(dirname):
if not os.path.isdir(dirname):
os.makedirs(dirname)
logfile = open(resultlog, 'w', 1) # line buffered
config._resultlog = ResultLog(config, logfile)