Skip to content

Commit

Permalink
ci: ensure Python is discoverable on PATH with sudo (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
P403n1x87 authored Oct 25, 2022
1 parent fb5ec02 commit feaa269
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
pip install --upgrade pip
pip install -r test/requirements.txt
.venv/bin/pytest --pastebin=failed --no-flaky-report -sr fE -n auto || true
sudo .venv/bin/pytest --pastebin=failed --no-flaky-report -sr fE -n auto || true
sudo -E env PATH="$PATH" .venv/bin/pytest --pastebin=failed --no-flaky-report -sr fE -n auto || true
deactivate
- name: Generate Cobertura report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
source .venv/bin/activate
pip install --upgrade pip
pip install -r test/requirements.txt
sudo -E .venv/bin/pytest --pastebin=failed --no-flaky-report -sr a
sudo -E env PATH="$PATH" .venv/bin/pytest --pastebin=failed --no-flaky-report -sr a
.venv/bin/pytest --pastebin=failed --no-flaky-report -sr a
deactivate
Expand Down
4 changes: 2 additions & 2 deletions test/test_attach.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def test_where_multiprocess(py):
assert lines[join_line] == 1, compress(result.stdout)


@flaky(max_runs=3)
@flaky(max_runs=6)
@requires_sudo
@allpythons()
def test_where_kernel(py):
with run_python(py, target("sleepy.py"), sleep_after=1) as p:
with run_python(py, target("sleepy.py"), sleep_after=0.5) as p:
result = austinp("-kw", str(p.pid))
assert result.returncode == 0

Expand Down
19 changes: 1 addition & 18 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,6 @@ def python(version: str) -> list[str]:
check_output([*py, "-V"], stderr=STDOUT)
return py
except FileNotFoundError:
if pl == "Linux":
# Try with just the major version
py = [f"python{version.split('.')[0]}"]
try:
if version in check_output([*py, "-V"], stderr=STDOUT).decode():
return py
except FileNotFoundError:
pass

# Try with no version
py = ["python"]
try:
if version in check_output([*py, "-V"], stderr=STDOUT).decode():
return py
except FileNotFoundError:
pass

pytest.skip(f"Python {version} not found")


Expand Down Expand Up @@ -191,7 +174,7 @@ def run_async(command: list[str], *args: tuple[str]) -> Popen:
return Popen(command + list(args), stdout=PIPE, stderr=PIPE)


def run_python(version, *args: tuple[str], sleep_after: int | None = None) -> Popen:
def run_python(version, *args: tuple[str], sleep_after: float | None = None) -> Popen:
result = run_async(python(version), *args)

if sleep_after is not None:
Expand Down

0 comments on commit feaa269

Please sign in to comment.