Skip to content

Commit

Permalink
test(pids,pgids): check current p(g)id in completions
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Aug 6, 2023
1 parent 5250728 commit 383756c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion test/t/unit/test_unit_pgids.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pytest

from conftest import assert_bash_exec, bash_env_saved
Expand All @@ -18,7 +20,7 @@ def test_non_pollution(self, bash):
)

def test_ints(self, bash):
"""Test that we get something, and only ints."""
"""Test that we get something sensible, and only int'y strings."""
with bash_env_saved(bash) as bash_env:
bash_env.write_variable("cur", "")
completion = assert_bash_exec(
Expand All @@ -27,4 +29,6 @@ def test_ints(self, bash):
want_output=True,
).split()
assert completion
if hasattr(os, "getpgid"):
assert str(os.getpgid(0)) in completion
assert all(x.isdigit() for x in completion)
6 changes: 5 additions & 1 deletion test/t/unit/test_unit_pids.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pytest

from conftest import assert_bash_exec, bash_env_saved
Expand All @@ -18,7 +20,7 @@ def test_non_pollution(self, bash):
)

def test_ints(self, bash):
"""Test that we get something, and only ints."""
"""Test that we get something sensible, and only int'y strings."""
with bash_env_saved(bash) as bash_env:
bash_env.write_variable("cur", "")
completion = assert_bash_exec(
Expand All @@ -27,4 +29,6 @@ def test_ints(self, bash):
want_output=True,
).split()
assert completion
if hasattr(os, "getpid"):
assert str(os.getpid()) in completion
assert all(x.isdigit() for x in completion)

0 comments on commit 383756c

Please sign in to comment.