Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷‍♂️ Consistently use sys.executable to run subprocesses, needed by OpenSUSE #408

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/test_compat/test_option_get_help.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import subprocess
import sys

import typer.core
from typer.testing import CliRunner
Expand Down Expand Up @@ -40,7 +41,7 @@ def test_coverage_call():

def test_completion():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down
16 changes: 8 additions & 8 deletions tests/test_completion/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_install_completion():

def test_completion_invalid_instruction():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -63,7 +63,7 @@ def test_completion_invalid_instruction():

def test_completion_source_bash():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -81,7 +81,7 @@ def test_completion_source_bash():

def test_completion_source_invalid_shell():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -96,7 +96,7 @@ def test_completion_source_invalid_shell():

def test_completion_source_invalid_instruction():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -111,7 +111,7 @@ def test_completion_source_invalid_instruction():

def test_completion_source_zsh():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -126,7 +126,7 @@ def test_completion_source_zsh():

def test_completion_source_fish():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -141,7 +141,7 @@ def test_completion_source_fish():

def test_completion_source_powershell():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -159,7 +159,7 @@ def test_completion_source_powershell():

def test_completion_source_pwsh():
result = subprocess.run(
["coverage", "run", mod.__file__],
[sys.executable, "-m", "coverage", "run", mod.__file__],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down
21 changes: 11 additions & 10 deletions tests/test_completion/test_completion_complete.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import subprocess
import sys

from docs_src.commands.help import tutorial001 as mod


def test_completion_complete_subcommand_bash():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -23,7 +24,7 @@ def test_completion_complete_subcommand_bash():

def test_completion_complete_subcommand_bash_invalid():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -40,7 +41,7 @@ def test_completion_complete_subcommand_bash_invalid():

def test_completion_complete_subcommand_zsh():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -59,7 +60,7 @@ def test_completion_complete_subcommand_zsh():

def test_completion_complete_subcommand_zsh_files():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -75,7 +76,7 @@ def test_completion_complete_subcommand_zsh_files():

def test_completion_complete_subcommand_fish():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -95,7 +96,7 @@ def test_completion_complete_subcommand_fish():

def test_completion_complete_subcommand_fish_should_complete():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -112,7 +113,7 @@ def test_completion_complete_subcommand_fish_should_complete():

def test_completion_complete_subcommand_fish_should_complete_no():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -129,7 +130,7 @@ def test_completion_complete_subcommand_fish_should_complete_no():

def test_completion_complete_subcommand_powershell():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -147,7 +148,7 @@ def test_completion_complete_subcommand_powershell():

def test_completion_complete_subcommand_pwsh():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -165,7 +166,7 @@ def test_completion_complete_subcommand_pwsh():

def test_completion_complete_subcommand_noshell():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down
9 changes: 5 additions & 4 deletions tests/test_completion/test_completion_complete_no_help.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import subprocess
import sys

from docs_src.commands.index import tutorial002 as mod


def test_completion_complete_subcommand_zsh():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -23,7 +24,7 @@ def test_completion_complete_subcommand_zsh():

def test_completion_complete_subcommand_fish():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -40,7 +41,7 @@ def test_completion_complete_subcommand_fish():

def test_completion_complete_subcommand_powershell():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -56,7 +57,7 @@ def test_completion_complete_subcommand_powershell():

def test_completion_complete_subcommand_pwsh():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down
33 changes: 29 additions & 4 deletions tests/test_completion/test_completion_install.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import subprocess
import sys
from pathlib import Path
from unittest import mock

Expand All @@ -16,7 +17,7 @@

def test_completion_install_no_shell():
result = subprocess.run(
["coverage", "run", mod.__file__, "--install-completion"],
[sys.executable, "-m", "coverage", "run", mod.__file__, "--install-completion"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -39,7 +40,15 @@ def test_completion_install_bash():
if bash_completion_path.is_file():
text = bash_completion_path.read_text()
result = subprocess.run(
["coverage", "run", mod.__file__, "--install-completion", "bash"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--install-completion",
"bash",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down Expand Up @@ -74,7 +83,15 @@ def test_completion_install_zsh():
if completion_path.is_file():
text = completion_path.read_text()
result = subprocess.run(
["coverage", "run", mod.__file__, "--install-completion", "zsh"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--install-completion",
"zsh",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down Expand Up @@ -103,7 +120,15 @@ def test_completion_install_fish():
Path.home() / f".config/fish/completions/{script_path.name}.fish"
)
result = subprocess.run(
["coverage", "run", mod.__file__, "--install-completion", "fish"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--install-completion",
"fish",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down
53 changes: 47 additions & 6 deletions tests/test_completion/test_completion_show.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import subprocess
import sys

from docs_src.commands.index import tutorial001 as mod


def test_completion_show_no_shell():
result = subprocess.run(
["coverage", "run", mod.__file__, "--show-completion"],
[sys.executable, "-m", "coverage", "run", mod.__file__, "--show-completion"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -25,7 +26,15 @@ def test_completion_show_no_shell():

def test_completion_show_bash():
result = subprocess.run(
["coverage", "run", mod.__file__, "--show-completion", "bash"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--show-completion",
"bash",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -43,7 +52,15 @@ def test_completion_show_bash():

def test_completion_source_zsh():
result = subprocess.run(
["coverage", "run", mod.__file__, "--show-completion", "zsh"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--show-completion",
"zsh",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -58,7 +75,15 @@ def test_completion_source_zsh():

def test_completion_source_fish():
result = subprocess.run(
["coverage", "run", mod.__file__, "--show-completion", "fish"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--show-completion",
"fish",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -73,7 +98,15 @@ def test_completion_source_fish():

def test_completion_source_powershell():
result = subprocess.run(
["coverage", "run", mod.__file__, "--show-completion", "powershell"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--show-completion",
"powershell",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand All @@ -91,7 +124,15 @@ def test_completion_source_powershell():

def test_completion_source_pwsh():
result = subprocess.run(
["coverage", "run", mod.__file__, "--show-completion", "pwsh"],
[
sys.executable,
"-m",
"coverage",
"run",
mod.__file__,
"--show-completion",
"pwsh",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
Expand Down
Loading