diff --git a/_pytest/config.py b/_pytest/config.py index dedffd5a67d..acfc1598915 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -300,7 +300,7 @@ def _set_initial_conftests(self, namespace): been loaded, however, so common options will not confuse our logic here. """ - current = py.path.local() + current = os.getcwd() self._confcutdir = current.join(namespace.confcutdir, abs=True) \ if namespace.confcutdir else None self._noconftest = namespace.noconftest @@ -988,7 +988,7 @@ def _initini(self, args): self.rootdir, self.inifile, self.inicfg = r self._parser.extra_info['rootdir'] = self.rootdir self._parser.extra_info['inifile'] = self.inifile - self.invocation_dir = py.path.local() + self.invocation_dir = os.getcwd() self._parser.addini('addopts', 'extra command line options', 'args') self._parser.addini('minversion', 'minimally required pytest version') self._override_ini = ns.override_ini or () @@ -1254,7 +1254,7 @@ def getcfg(args, warnfunc=None): inibasenames = ["pytest.ini", "tox.ini", "setup.cfg"] args = [x for x in args if not str(x).startswith("-")] if not args: - args = [py.path.local()] + args = [os.getcwd()] for arg in args: arg = py.path.local(arg) for base in arg.parts(reverse=True): @@ -1291,7 +1291,7 @@ def get_common_ancestor(paths): if shared is not None: common_ancestor = shared if common_ancestor is None: - common_ancestor = py.path.local() + common_ancestor = os.getcwd() elif common_ancestor.isfile(): common_ancestor = common_ancestor.dirpath() return common_ancestor @@ -1342,7 +1342,7 @@ def determine_setup(inifile, args, warnfunc=None): else: rootdir, inifile, inicfg = getcfg(dirs, warnfunc=warnfunc) if rootdir is None: - rootdir = get_common_ancestor([py.path.local(), ancestor]) + rootdir = get_common_ancestor([os.getcwd(), ancestor]) is_fs_root = os.path.splitdrive(str(rootdir))[1] == os.sep if is_fs_root: rootdir = ancestor diff --git a/_pytest/main.py b/_pytest/main.py index f05cb7ff3b3..436f7d2b1b9 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -575,7 +575,7 @@ def __init__(self, config): self.shouldstop = False self.trace = config.trace.root.get("collection") self._norecursepatterns = config.getini("norecursedirs") - self.startdir = py.path.local() + self.startdir = os.getcwd() self.config.pluginmanager.register(self, name="session") def _makeid(self): diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 2d2683574ac..13ff1326c97 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -936,7 +936,7 @@ def _run(self, *cmdargs): p1 = self.tmpdir.join("stdout") p2 = self.tmpdir.join("stderr") print("running:", ' '.join(cmdargs)) - print(" in:", str(py.path.local())) + print(" in:", str(os.getcwd())) f1 = codecs.open(str(p1), "w", encoding="utf8") f2 = codecs.open(str(p2), "w", encoding="utf8") try: diff --git a/_pytest/python.py b/_pytest/python.py index bdf14d84164..8078b713368 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -976,7 +976,7 @@ def show_fixtures_per_test(config): def _show_fixtures_per_test(config, session): import _pytest.config session.perform_collect() - curdir = py.path.local() + curdir = os.getcwd() tw = _pytest.config.create_terminal_writer(config) verbose = config.getvalue("verbose") @@ -1034,7 +1034,7 @@ def showfixtures(config): def _showfixtures_main(config, session): import _pytest.config session.perform_collect() - curdir = py.path.local() + curdir = os.getcwd() tw = _pytest.config.create_terminal_writer(config) verbose = config.getvalue("verbose") diff --git a/_pytest/resultlog.py b/_pytest/resultlog.py index 9f9c2d1f653..da6cdb44294 100644 --- a/_pytest/resultlog.py +++ b/_pytest/resultlog.py @@ -3,7 +3,6 @@ """ from __future__ import absolute_import, division, print_function -import py import os @@ -109,5 +108,5 @@ def pytest_internalerror(self, excrepr): reprcrash = getattr(excrepr, 'reprcrash', None) path = getattr(reprcrash, "path", None) if path is None: - path = "cwd:%s" % py.path.local() + path = "cwd:%s" % os.getcwd() self.write_log_entry(path, '!', str(excrepr)) diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 0a023d1f35f..a019a066e5f 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -134,7 +134,7 @@ def __init__(self, config, file=None): self._numcollected = 0 self.stats = {} - self.startdir = py.path.local() + self.startdir = os.getcwd() if file is None: file = sys.stdout self._tw = self.writer = _pytest.config.create_terminal_writer(config,