Skip to content

Commit 483f0c6

Browse files
Test relative include cycles through nested paths
1 parent 6244f1d commit 483f0c6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/test_config.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,22 @@ def check_test_value(cr, value):
249249
@with_rw_directory
250250
def test_config_include_from_relative_config_path(self, rw_dir):
251251
fpa = osp.join(rw_dir, "a")
252-
fpb = osp.join(rw_dir, "b")
252+
nested_dir = osp.join(rw_dir, "subdir")
253+
os.makedirs(nested_dir)
254+
fpb = osp.join(nested_dir, "b")
253255

254256
with GitConfigParser(fpa, read_only=False) as cw:
255257
cw.set_value("a", "value", "a")
256-
cw.set_value("include", "path", "b")
258+
cw.set_value("include", "path", "subdir/b")
257259

258260
with GitConfigParser(fpb, read_only=False) as cw:
259261
cw.set_value("b", "value", "b")
260-
cw.set_value("include", "path", "a")
262+
cw.set_value("include", "path", "../a")
261263

262264
with GitConfigParser(osp.relpath(fpa), read_only=True) as cr:
263265
assert cr.get_value("a", "value") == "a"
264266
assert cr.get_value("b", "value") == "b"
265-
assert cr.get_values("include", "path") == ["b", "a"]
267+
assert cr.get_values("include", "path") == ["subdir/b", "../a"]
266268

267269
@with_rw_directory
268270
def test_multiple_include_paths_with_same_key(self, rw_dir):

0 commit comments

Comments
 (0)