Move _uniquepath to pathlib as unique_path.
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
@@ -4,9 +4,9 @@ import textwrap
|
||||
import py
|
||||
|
||||
import pytest
|
||||
from _pytest.config import _uniquepath
|
||||
from _pytest.config import PytestPluginManager
|
||||
from _pytest.main import ExitCode
|
||||
from _pytest.pathlib import unique_path
|
||||
|
||||
|
||||
def ConftestWithSetinitial(path):
|
||||
@@ -143,11 +143,11 @@ def test_conftestcutdir(testdir):
|
||||
# but we can still import a conftest directly
|
||||
conftest._importconftest(conf)
|
||||
values = conftest._getconftestmodules(conf.dirpath())
|
||||
assert values[0].__file__.startswith(str(_uniquepath(conf)))
|
||||
assert values[0].__file__.startswith(str(unique_path(conf)))
|
||||
# and all sub paths get updated properly
|
||||
values = conftest._getconftestmodules(p)
|
||||
assert len(values) == 1
|
||||
assert values[0].__file__.startswith(str(_uniquepath(conf)))
|
||||
assert values[0].__file__.startswith(str(unique_path(conf)))
|
||||
|
||||
|
||||
def test_conftestcutdir_inplace_considered(testdir):
|
||||
@@ -156,7 +156,7 @@ def test_conftestcutdir_inplace_considered(testdir):
|
||||
conftest_setinitial(conftest, [conf.dirpath()], confcutdir=conf.dirpath())
|
||||
values = conftest._getconftestmodules(conf.dirpath())
|
||||
assert len(values) == 1
|
||||
assert values[0].__file__.startswith(str(_uniquepath(conf)))
|
||||
assert values[0].__file__.startswith(str(unique_path(conf)))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", "test tests whatever .dotdir".split())
|
||||
@@ -166,7 +166,7 @@ def test_setinitial_conftest_subdirs(testdir, name):
|
||||
conftest = PytestPluginManager()
|
||||
conftest_setinitial(conftest, [sub.dirpath()], confcutdir=testdir.tmpdir)
|
||||
if name not in ("whatever", ".dotdir"):
|
||||
assert _uniquepath(subconftest) in conftest._conftestpath2mod
|
||||
assert unique_path(subconftest) in conftest._conftestpath2mod
|
||||
assert len(conftest._conftestpath2mod) == 1
|
||||
else:
|
||||
assert subconftest not in conftest._conftestpath2mod
|
||||
|
||||
Reference in New Issue
Block a user