Skip to content

Commit 383756c

Browse files
committed
test(pids,pgids): check current p(g)id in completions
1 parent 5250728 commit 383756c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/t/unit/test_unit_pgids.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24

35
from conftest import assert_bash_exec, bash_env_saved
@@ -18,7 +20,7 @@ def test_non_pollution(self, bash):
1820
)
1921

2022
def test_ints(self, bash):
21-
"""Test that we get something, and only ints."""
23+
"""Test that we get something sensible, and only int'y strings."""
2224
with bash_env_saved(bash) as bash_env:
2325
bash_env.write_variable("cur", "")
2426
completion = assert_bash_exec(
@@ -27,4 +29,6 @@ def test_ints(self, bash):
2729
want_output=True,
2830
).split()
2931
assert completion
32+
if hasattr(os, "getpgid"):
33+
assert str(os.getpgid(0)) in completion
3034
assert all(x.isdigit() for x in completion)

test/t/unit/test_unit_pids.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24

35
from conftest import assert_bash_exec, bash_env_saved
@@ -18,7 +20,7 @@ def test_non_pollution(self, bash):
1820
)
1921

2022
def test_ints(self, bash):
21-
"""Test that we get something, and only ints."""
23+
"""Test that we get something sensible, and only int'y strings."""
2224
with bash_env_saved(bash) as bash_env:
2325
bash_env.write_variable("cur", "")
2426
completion = assert_bash_exec(
@@ -27,4 +29,6 @@ def test_ints(self, bash):
2729
want_output=True,
2830
).split()
2931
assert completion
32+
if hasattr(os, "getpid"):
33+
assert str(os.getpid()) in completion
3034
assert all(x.isdigit() for x in completion)

0 commit comments

Comments
 (0)