Use config_invocation_dir for startdirs

`Session.startdir` and `TerminalReporter.startdir` appear to be
redundant given `Config.invocation_dir`.
Keep them for backward compatibility reasons, but use
`config.invocation_dir` for them.
This commit is contained in:
Daniel Hahler 2019-04-22 02:04:07 +02:00
parent 1460ad6027
commit 0bf363472e
2 changed files with 2 additions and 2 deletions

View File

@ -434,7 +434,7 @@ class Session(nodes.FSCollector):
self.shouldfail = False self.shouldfail = False
self.trace = config.trace.root.get("collection") self.trace = config.trace.root.get("collection")
self._norecursepatterns = config.getini("norecursedirs") self._norecursepatterns = config.getini("norecursedirs")
self.startdir = py.path.local() self.startdir = config.invocation_dir
self._initialpaths = frozenset() self._initialpaths = frozenset()
# Keep track of any collected nodes in here, so we don't duplicate fixtures # Keep track of any collected nodes in here, so we don't duplicate fixtures
self._node_cache = {} self._node_cache = {}

View File

@ -234,7 +234,7 @@ class TerminalReporter(object):
self._showfspath = None self._showfspath = None
self.stats = {} self.stats = {}
self.startdir = py.path.local() self.startdir = config.invocation_dir
if file is None: if file is None:
file = sys.stdout file = sys.stdout
self._tw = _pytest.config.create_terminal_writer(config, file) self._tw = _pytest.config.create_terminal_writer(config, file)