Skip to content

Commit e22e409

Browse files
committed
test(assert_complete): support "shopt" arg
1 parent 864f7f4 commit e22e409

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

test/t/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ def assert_bash_exec(
389389

390390

391391
class bash_env_saved:
392-
393392
def __init__(self, bash: pexpect.spawn, sendintr: bool = False):
394393
self.bash = bash
395394
self.cwd: Optional[str] = None
@@ -609,6 +608,9 @@ def assert_complete(
609608
for k, v in kwargs.get("env", {}).items():
610609
bash_env.write_env(k, v)
611610

611+
for k, v in kwargs.get("shopt", {}).items():
612+
bash_env.shopt(k, v)
613+
612614
bash.send(cmd + "\t")
613615
# Sleep a bit if requested, to avoid `.*` matching too early
614616
time.sleep(kwargs.get("sleep_after_tab", 0))

test/t/test_man.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,10 @@ def test_8(self, completion):
100100
"man %s" % assumed_present,
101101
require_cmd=True,
102102
cwd="shared/empty_dir",
103-
pre_cmds=("shopt -s failglob",),
103+
shopt=dict(failglob=True),
104104
)
105105
def test_9(self, bash, completion):
106106
assert self.assumed_present in completion
107-
assert_bash_exec(bash, "shopt -u failglob")
108107

109108
@pytest.mark.complete(require_cmd=True)
110109
def test_10(self, request, bash, colonpath):

test/t/test_tar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ def gnu_tar(self, bash):
1313
if not re.search(r"\bGNU ", got):
1414
pytest.skip("Not GNU tar")
1515

16-
@pytest.mark.complete("tar ", pre_cmds=("shopt -s failglob",))
16+
@pytest.mark.complete("tar ", shopt=dict(failglob=True))
1717
def test_1(self, bash, completion):
1818
assert completion
19-
assert_bash_exec(bash, "shopt -u failglob")
2019

2120
# Test "f" when mode is not as first option
2221
@pytest.mark.complete("tar zfc ", cwd="tar")

0 commit comments

Comments
 (0)