1
- import os .path
2
1
import textwrap
3
2
4
3
import py
5
4
6
5
import pytest
7
6
from _pytest .config import PytestPluginManager
8
7
from _pytest .main import ExitCode
9
- from _pytest .pathlib import unique_path
10
8
11
9
12
10
def ConftestWithSetinitial (path ):
@@ -143,11 +141,11 @@ def test_conftestcutdir(testdir):
143
141
# but we can still import a conftest directly
144
142
conftest ._importconftest (conf )
145
143
values = conftest ._getconftestmodules (conf .dirpath ())
146
- assert values [0 ].__file__ .startswith (str (unique_path ( conf ) ))
144
+ assert values [0 ].__file__ .startswith (str (conf ))
147
145
# and all sub paths get updated properly
148
146
values = conftest ._getconftestmodules (p )
149
147
assert len (values ) == 1
150
- assert values [0 ].__file__ .startswith (str (unique_path ( conf ) ))
148
+ assert values [0 ].__file__ .startswith (str (conf ))
151
149
152
150
153
151
def test_conftestcutdir_inplace_considered (testdir ):
@@ -156,7 +154,7 @@ def test_conftestcutdir_inplace_considered(testdir):
156
154
conftest_setinitial (conftest , [conf .dirpath ()], confcutdir = conf .dirpath ())
157
155
values = conftest ._getconftestmodules (conf .dirpath ())
158
156
assert len (values ) == 1
159
- assert values [0 ].__file__ .startswith (str (unique_path ( conf ) ))
157
+ assert values [0 ].__file__ .startswith (str (conf ))
160
158
161
159
162
160
@pytest .mark .parametrize ("name" , "test tests whatever .dotdir" .split ())
@@ -166,7 +164,7 @@ def test_setinitial_conftest_subdirs(testdir, name):
166
164
conftest = PytestPluginManager ()
167
165
conftest_setinitial (conftest , [sub .dirpath ()], confcutdir = testdir .tmpdir )
168
166
if name not in ("whatever" , ".dotdir" ):
169
- assert unique_path ( subconftest ) in conftest ._conftestpath2mod
167
+ assert subconftest in conftest ._conftestpath2mod
170
168
assert len (conftest ._conftestpath2mod ) == 1
171
169
else :
172
170
assert subconftest not in conftest ._conftestpath2mod
@@ -277,21 +275,6 @@ def fixture():
277
275
assert result .ret == ExitCode .OK
278
276
279
277
280
- @pytest .mark .skipif (
281
- os .path .normcase ("x" ) != os .path .normcase ("X" ),
282
- reason = "only relevant for case insensitive file systems" ,
283
- )
284
- def test_conftest_badcase (testdir ):
285
- """Check conftest.py loading when directory casing is wrong."""
286
- testdir .tmpdir .mkdir ("JenkinsRoot" ).mkdir ("test" )
287
- source = {"setup.py" : "" , "test/__init__.py" : "" , "test/conftest.py" : "" }
288
- testdir .makepyfile (** {"JenkinsRoot/%s" % k : v for k , v in source .items ()})
289
-
290
- testdir .tmpdir .join ("jenkinsroot/test" ).chdir ()
291
- result = testdir .runpytest ()
292
- assert result .ret == ExitCode .NO_TESTS_COLLECTED
293
-
294
-
295
278
def test_no_conftest (testdir ):
296
279
testdir .makeconftest ("assert 0" )
297
280
result = testdir .runpytest ("--noconftest" )
0 commit comments