repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
nat-n/poethepoet | import re
from poethepoet import __version__
poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_version_option(run_poe):
result = run_poe("--version")
assert result.code == 0, "Expected zero result"
assert result.capture.strip() == f"Poe the Poet - version: {__version__}"
assert result.st... | "" | assert | string_literal | tests/test_cli.py | test_version_option | 91 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_comments():
tree = parse_poe_cmd(
"""# 1
... | "" | assert | string_literal | tests/helpers/command/test_ast.py | test_parse_comments | 27 | null | |
nat-n/poethepoet | import pytest
def test_sequence_task(run_poe_subproc, esc_prefix):
result = run_poe_subproc("composite_task", project="sequences")
assert result.capture == (
"Poe => poe_test_echo Hello\n"
"Poe => poe_test_echo 'World!'\n"
"Poe => poe_test_echo ':)!'\n"
)
assert result.stdout ==... | "" | assert | string_literal | tests/test_sequence_tasks.py | test_sequence_task | 12 | null | |
nat-n/poethepoet | import pytest
def generate_pyproject(temp_pyproject):
def generator(project_verbosity=0, task_verbosity=0):
def inline_task(inline_verbosity: int) -> str:
return (
'{ cmd = "poe_test_echo inline_task '
+ str(inline_verbosity)
+ ' ${POE_VERBOSITY}"... | "Poe => poe_test_echo 'cmd task inheriting default verbosity -1 0'\n" "Poe => poe_test_echo inline_task 0 0\n" "Poe => poe_test_echo inline_task 1 1\n" "Poe => poe_test_echo inline_task 2 2\n" | assert | string_literal | tests/test_verbosity.py | test_sequence_task_with_verbosity | 161 | null | |
nat-n/poethepoet | poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_setting_default_verbosity(run_poe_subproc, low_verbosity_project_path):
result = run_poe_subproc(
"test",
cwd=low_verbosity_project_path,
)
assert result.capture == | "" | assert | string_literal | tests/test_poe_config.py | test_setting_default_verbosity | 48 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_line_breaks():
tree = Script(
ParseCursor.from... | 6 | assert | numeric_literal | tests/helpers/command/test_ast.py | test_parse_line_breaks | 549 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_param_operators():
tree = parse_poe_cmd(
"""
... | 14 | assert | numeric_literal | tests/helpers/command/test_ast.py | test_parse_param_operators | 136 | null | |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
@pytest.mark.flaky(reruns=3, reruns_delay=1)
def test_parallel_task_with_redirected_outputs(run_poe_subproc, tests_temp_dir):
result = run_poe_subproc("parallel_with_stdout_capture", project="parallel")
assert result.capture_lines == | [ "Poe => poe_test_echo '1 going to stdout 1'", "Poe <= poe_test_echo '2 going to file'", "Poe <= poe_test_echo '3 going to the void'", "Poe => poe_test_echo '4 going to stdout 4'", ] | assert | collection | tests/test_parallel_tasks.py | test_parallel_task_with_redirected_outputs | 42 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | script | assert | variable | tests/completion/test_bash_completion.py | test_has_global_options | TestBashCompletionScript | 41 | null |
nat-n/poethepoet | import os
from pathlib import Path
from shutil import rmtree
import pytest
from poethepoet.scripts import rm
_test_file_tree = {
"pkg": {
"__pycache__": {"foo.pyc": "XXX"},
"foo.py": "XXX",
"bar": {
"baz.py": "XXX",
"__pycache__": {"baz.pyc": "XXX"},
},
... | "" | assert | string_literal | tests/test_scripts.py | test_rm_dry_mode | 74 | null | |
nat-n/poethepoet | import pytest
def generate_pyproject(temp_pyproject):
def generator(project_verbosity=0, task_verbosity=0):
def inline_task(inline_verbosity: int) -> str:
return (
'{ cmd = "poe_test_echo inline_task '
+ str(inline_verbosity)
+ ' ${POE_VERBOSITY}"... | "cmd task inheriting default verbosity 0 0\n" "inline_task -2 -2\n" "inline_task -1 -1\n" "inline_task 0 0\n" "inline_task 1 1\n" "inline_task 2 2\n" | assert | string_literal | tests/test_verbosity.py | test_sequence_task_with_verbosity | 150 | null | |
nat-n/poethepoet | def test_customize_config_name_with_json(run_poe, projects, capsys):
result = run_poe("hello", config_name="tasks.json", project="custom_config")
assert result.capture == | "Poe => poe_test_echo hello from tasks.json\n" | assert | string_literal | tests/test_api.py | test_customize_config_name_with_json | 28 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
from poethepoet import _escape_choice, _format_help
def test_describe_task_args(run_poe_main, projects):
# Test with a task that has args defined
scripts_path = str(projects["scripts"])
result = run_poe_main("_describe_task_args", "greet-full-args", scripts_p... | 4 | assert | numeric_literal | tests/completion/test_zsh_completion.py | test_describe_task_args | 177 | null | |
nat-n/poethepoet | from typing import Annotated, Any, TypedDict
import pytest
from poethepoet.exceptions import ConfigValidationError
from poethepoet.options import PoeOptions
from poethepoet.options.annotations import Metadata
def test_poe_options_basic_parse_and_defaults():
"""Basic parse: provided values are kept; defaults are ... | "hello" | assert | string_literal | tests/options/test_options.py | test_poe_options_basic_parse_and_defaults | 38 | null | |
nat-n/poethepoet | import os
import re
import pytest
def _setup_poetry_project(run_poetry_2, projects):
run_poetry_2(["install"], cwd=projects["poetry_plugin"])
def _setup_poetry_project_empty_prefix(run_poetry_2, projects):
run_poetry_2(
["install"],
cwd=projects["poetry_plugin/empty_prefix"].parent,
)
de... | result.stdout | assert | complex_expr | tests/test_poetry_plugin_v2.py | test_poetry_help | 32 | null | |
nat-n/poethepoet | import pytest
def test_sequence_task_with_multiple_value_arg(run_poe_subproc):
result = run_poe_subproc(
"multiple-value-arg", "hey", "1", "2", "3", project="sequences"
)
assert result.capture == (
"Poe => poe_test_echo first: hey\nPoe => poe_test_echo second: '1 2 3'\n"
"Poe => poe... | "first: hey\nsecond: 1 2 3\nDone.\n" | assert | string_literal | tests/test_sequence_tasks.py | test_sequence_task_with_multiple_value_arg | 69 | null | |
nat-n/poethepoet | import os
import re
import pytest
def _setup_poetry_project(run_poetry_2, projects):
run_poetry_2(["install"], cwd=projects["poetry_plugin"])
def _setup_poetry_project_empty_prefix(run_poetry_2, projects):
run_poetry_2(
["install"],
cwd=projects["poetry_plugin/empty_prefix"].parent,
)
de... | "Poe => from cowpy import cow; print(list(cow.COWACTERS)[5])\ncheese\n" | assert | string_literal | tests/test_poetry_plugin_v2.py | test_task_with_lib_dependency | 69 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | "_private" | assert | string_literal | tests/completion/test_bash_completion_harness.py | test_task_starting_with_underscore | TestBashTaskNamePatterns | 1,264 | null |
nat-n/poethepoet | EXAMPLE_CONFIG = """
[tool.poe.env]
GLOBAL_POE_ROOT = "${POE_ROOT}"
GLOBAL_POE_PWD = "${POE_PWD}"
[tool.poe.tasks.my-task]
default_item_type = "cmd"
sequence = [
"echo POE_ROOT: ${POE_ROOT}",
"echo GLOBAL_POE_ROOT: ${GLOBAL_POE_ROOT}",
"echo TASK_POE_ROOT: ${TASK_POE_ROOT}",
"echo POE_PWD: ${POE_PWD}",
"echo... | "/foo/bar/baz\n" | assert | string_literal | tests/test_env_config.py | test_substitution_in_envvar | 53 | null | |
nat-n/poethepoet | import sys
import pytest
PY_V = f"{sys.version_info.major}.{sys.version_info.minor}"
def test_override_executor_config(run_poe_subproc):
"""
Rely on task level config to correctly set the virtualenv location
"""
result = run_poe_subproc("override-executor", project="venv")
assert result.capture =... | result.stdout | assert | complex_expr | tests/test_executors.py | test_override_executor_config | 71 | null | |
nat-n/poethepoet | import pytest
def test_a_script_sequence_task_with_args(run_poe_subproc, esc_prefix):
# This should be exactly the same as calling the composite_task task directly
result = run_poe_subproc("greet-multiple", "--mouse=Jerry", project="sequences")
assert result.capture == (
"""Poe => 'my_package:main(... | "hello Tom\nhello Jerry\n" | assert | string_literal | tests/test_sequence_tasks.py | test_a_script_sequence_task_with_args | 57 | null | |
nat-n/poethepoet | EXAMPLE_CONFIG = """
[tool.poe.env]
GLOBAL_POE_ROOT = "${POE_ROOT}"
GLOBAL_POE_PWD = "${POE_PWD}"
[tool.poe.tasks.my-task]
default_item_type = "cmd"
sequence = [
"echo POE_ROOT: ${POE_ROOT}",
"echo GLOBAL_POE_ROOT: ${GLOBAL_POE_ROOT}",
"echo TASK_POE_ROOT: ${TASK_POE_ROOT}",
"echo POE_PWD: ${POE_PWD}",
"echo... | "" | assert | string_literal | tests/test_env_config.py | test_substitution_in_envvar | 54 | null | |
nat-n/poethepoet | from poethepoet.helpers.command import parse_poe_cmd, resolve_command_tokens
def test_resolve_command_tokens():
line = parse_poe_cmd(
"""
abc${thing1}def *$thing2?
"""
)[0]
assert list(resolve_command_tokens([line], {"thing2": ""})) == [
("abcdef", False),
("*?", Tr... | [ (r"ab *\o/* and ? ' *\o/'", False), ("${thing1}", False), ("", False), ] | assert | collection | tests/helpers/command/test_command_parsing.py | test_resolve_command_tokens | 59 | null | |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
def generate_pyproject(temp_pyproject):
def generator(
delay_factor=1,
seq1_ignore_fail=False,
seq2_ignore_fail=False,
para1_ignore_fail=False,
para2_ignore_fail=False,
):
def fmt_ignore_fail(value):
... | 1 | assert | numeric_literal | tests/test_parallel_tasks.py | test_parallel_fail_all | 178 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_comments():
tree = parse_poe_cmd(
"""# 1
... | " 1" | assert | string_literal | tests/helpers/command/test_ast.py | test_parse_comments | 21 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
class TestZshCompletionE2E:
def completion_script(self, run_poe_main):
"""Get the generated zsh completion script."""
result = run_poe_main("_zsh_completion")
return result.stdout
def test_describe_task_args_completion(self, zsh_harness, ... | "args" | assert | string_literal | tests/completion/test_zsh_completion_harness.py | test_describe_task_args_completion | TestZshCompletionE2E | 277 | null |
nat-n/poethepoet | def test_customize_program_name(run_poe, projects):
result = run_poe(program_name="boop")
assert "Usage:\n boop [global options] task" in | result.capture | assert | complex_expr | tests/test_api.py | test_customize_program_name | 3 | null | |
nat-n/poethepoet | from typing import Annotated, Any, TypedDict
import pytest
from poethepoet.exceptions import ConfigValidationError
from poethepoet.options import PoeOptions
from poethepoet.options.annotations import Metadata
def test_duplicate_config_names_not_tolerated():
"""Duplicate config key mappings (between attribute and... | RuntimeError) | pytest.raises | variable | tests/options/test_options.py | test_duplicate_config_names_not_tolerated | 242 | null | |
nat-n/poethepoet | from poethepoet.helpers.command import parse_poe_cmd, resolve_command_tokens
def test_resolve_command_tokens():
line = parse_poe_cmd(
"""
abc${thing1}def *$thing2?
"""
)[0]
assert list(resolve_command_tokens([line], {"thing2": ""})) == [
("abcdef", False),
("*?", Tr... | [ ("abc", False), ("space", False), ("def", False), ("*s", True), ("p", False), ("a", False), ("c", False), ("e?", True), ] | assert | collection | tests/helpers/command/test_command_parsing.py | test_resolve_command_tokens | 16 | null | |
nat-n/poethepoet | import pytest
def generate_pyproject(temp_pyproject):
def generator(project_verbosity=0, task_verbosity=0):
def inline_task(inline_verbosity: int) -> str:
return (
'{ cmd = "poe_test_echo inline_task '
+ str(inline_verbosity)
+ ' ${POE_VERBOSITY}"... | "default verbosity\n" | assert | string_literal | tests/test_verbosity.py | test_switch_task_with_verbosity | 183 | null | |
nat-n/poethepoet | def test_bad_args_doc_with_custom_program_name(run_poe, projects, capsys):
result = run_poe("async-task", "--fail", program_name="boop", project="scripts")
assert result.stdout == ""
assert result.stderr == ""
asse | "usage: boop async-task [--a A] [--b B]\n" "boop async-task: error: unrecognized arguments: --fail\n" "Error: Invalid arguments for task 'async-task'\n" | assert | string_literal | tests/test_api.py | test_bad_args_doc_with_custom_program_name | 12 | null | |
nat-n/poethepoet | def test_multiple_envfiles(run_poe_subproc, projects):
result = run_poe_subproc(
f"-C={projects['envfile/multiple_envfiles']}", "show_me_the_vals"
)
assert (
"Poe => poe_test_echo 'VAL_A-VAL_B-VAL_C-VAL_D-VAL_E-VAL_F!!'\n"
in result.capture
)
assert result.stdout == | "VAL_A-VAL_B-VAL_C-VAL_D-VAL_E-VAL_F!!\n" | assert | string_literal | tests/test_envfile.py | test_multiple_envfiles | 30 | null | |
nat-n/poethepoet | import subprocess
import tempfile
from dataclasses import dataclass, field
from pathlib import Path
def escape_for_shell(value: str) -> str:
"""Escape a string for use in single-quoted shell context."""
return value.replace("'", "'\"'\"'")
class ZshHarnessRunner:
def __init__(self, work_dir: Path | None ... | None | assert | none_literal | tests/completion/harness.py | run | ZshHarnessRunner | 529 | null |
nat-n/poethepoet | import sys
def test_switch_multivalue_case(run_poe_subproc):
for num in ("1", "3", "5"):
result = run_poe_subproc(
"multivalue_case", project="switch", env={"WHATEVER": num}
)
assert result.capture == (
f"Poe <= poe_test_echo {num}\nPoe => import sys; print('It is in... | "It is 6\n" | assert | string_literal | tests/test_switch_task.py | test_switch_multivalue_case | 114 | null | |
nat-n/poethepoet | def test_prefer_valid_pyproject(run_poe_subproc, projects):
# and import the poe_tasks from elsewhere
result = run_poe_subproc(project="poe_tasks_file")
asser | result.capture | assert | complex_expr | tests/test_poe_tasks_file.py | test_prefer_valid_pyproject | 4 | null | |
nat-n/poethepoet | import os
import shutil
import pytest
def _uv_integration_available():
if not shutil.which("uv"):
return False
try:
import socket
sock = socket.create_connection(("pypi.org", 443), timeout=1)
except OSError:
return False
else:
sock.close()
return True
... | lines_set | assert | variable | tests/test_uv_executor.py | _assert_uv_options_present | 161 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | proc.stdout | assert | complex_expr | tests/completion/test_bash_completion_harness.py | test_script_can_be_sourced | TestBashCompletionBasic | 68 | null |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _powershell_is_available() -> bool:
"""Check if PowerShell is actually available and functional."""
# Check both pwsh (PowerShell Core) and powershell (Windows PowerShell)
for cmd in ("pwsh", "powershell"):
if shutil.which(cmd) is not None:
... | 0 | assert | numeric_literal | tests/completion/test_powershell_completion.py | test_script_generates_without_error | TestPowerShellCompletionSpecialTaskNames | 329 | null |
nat-n/poethepoet | def test_global_envfile_and_default(run_poe_subproc):
result = run_poe_subproc("test", project="default_value")
assert (
"Poe => poe_test_echo '!one!' '!two!' '!three!' '!four!' '!five!' '!six!'\n"
in result.capture
)
assert result.stdout == "!one! !two! !three! !four! !five! !six!\n"
... | "" | assert | string_literal | tests/test_default_value.py | test_global_envfile_and_default | 8 | null | |
nat-n/poethepoet | import pytest
def generate_pyproject(temp_pyproject):
def generator(project_verbosity=0, task_verbosity=0):
def inline_task(inline_verbosity: int) -> str:
return (
'{ cmd = "poe_test_echo inline_task '
+ str(inline_verbosity)
+ ' ${POE_VERBOSITY}"... | "cmd task with verbosity 0 0\n" | assert | string_literal | tests/test_verbosity.py | test_task_vs_project_verbosity | 82 | null | |
nat-n/poethepoet | import os
import shutil
import pytest
def _uv_integration_available():
if not shutil.which("uv"):
return False
try:
import socket
sock = socket.create_connection(("pypi.org", 443), timeout=1)
except OSError:
return False
else:
sock.close()
return True
... | result.stdout | assert | complex_expr | tests/test_uv_executor.py | test_uv_executor_env | 97 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
from poethepoet import _escape_choice, _format_help
class TestZshCompletionScriptNewFeatures:
def test_help_task_state_uses_hybrid_caching(self, run_poe_main):
"""Verify help_task state also uses hybrid disk/memory caching."""
result = run_poe_main("... | 2 | assert | numeric_literal | tests/completion/test_zsh_completion.py | test_help_task_state_uses_hybrid_caching | TestZshCompletionScriptNewFeatures | 759 | null |
nat-n/poethepoet | import shutil
import subprocess
import pytest
from poethepoet import _escape_choice, _format_help
def test_describe_task_args(run_poe_main, projects):
# Test with a task that has args defined
scripts_path = str(projects["scripts"])
result = run_poe_main("_describe_task_args", "greet-full-args", scripts_p... | 0 | assert | numeric_literal | tests/completion/test_zsh_completion.py | test_describe_task_args | 172 | null | |
nat-n/poethepoet | poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_setting_global_env_vars(run_poe_subproc):
result = run_poe_subproc("travel", env=poetry_vars)
assert (
result.capture == "Poe => poe_test_echo 'from EARTH to'\nPoe => 'travel[1]'\n"
)
assert result.stdout == | "from EARTH to\nMARS\n" | assert | string_literal | tests/test_poe_config.py | test_setting_global_env_vars | 39 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | 0 | assert | numeric_literal | tests/completion/test_bash_completion_harness.py | test_script_parses_without_error | TestBashCompletionBasic | 53 | null |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
@pytest.mark.flaky(reruns=3, reruns_delay=1)
def test_parallel_task_with_redirected_outputs(run_poe_subproc, tests_temp_dir):
result = run_poe_subproc("parallel_with_stdout_capture", project="parallel")
assert result.capture_lines == [
"Poe => poe_te... | "2 going to file\n" | assert | string_literal | tests/test_parallel_tasks.py | test_parallel_task_with_redirected_outputs | 53 | null | |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
@pytest.mark.flaky(reruns=3, reruns_delay=1)
def test_parallel_in_sequence_task(run_poe_subproc, delay_factor):
base = 50 * delay_factor
seq_delay = 2 * base
para_delay = base
result = run_poe_subproc(
"sequence_of_parallels", str(seq_delay), ... | [ f"Poe => poe_test_delayed_echo {seq_delay} seq1", f"Poe => poe_test_delayed_echo {para_delay} para1", "Poe => poe_test_echo para2", ] | assert | collection | tests/test_parallel_tasks.py | test_parallel_in_sequence_task | 86 | null | |
nat-n/poethepoet | def test_global_envfile_and_default_with_presets(run_poe_subproc):
env = {
"ONE": "111",
"TWO": "222",
"THREE": "333",
"FOUR": "444",
"FIVE": "555",
"SIX": "666",
}
result = run_poe_subproc("test", project="default_value", env=env)
assert (
"Poe =... | "!one! !two! !three! 444 !five! 666\n" | assert | string_literal | tests/test_default_value.py | test_global_envfile_and_default_with_presets | 26 | null | |
nat-n/poethepoet | import sys
def test_switch_on_env_var(run_poe_subproc):
common_prefix = "Poe <= int(${FOO_VAR}) % 2\n"
result = run_poe_subproc("var_dependent", project="switch", env={"FOO_VAR": "42"})
assert result.capture == common_prefix + "Poe => f'{${FOO_VAR}} is even'\n"
assert result.stdout == "42 is even\n"
... | "99 is odd\n" | assert | string_literal | tests/test_switch_task.py | test_switch_on_env_var | 59 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_quotes():
tree = parse_poe_cmd(
"""
x'... | True | assert | bool_literal | tests/helpers/command/test_ast.py | test_parse_quotes | 381 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_ast_node_inspection():
tree = parse_poe_cmd(
"""
... | "!" | assert | string_literal | tests/helpers/command/test_ast.py | test_ast_node_inspection | 604 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_non_globs():
tree = Script(
ParseCursor.from_f... | 1 | assert | numeric_literal | tests/helpers/command/test_ast.py | test_parse_non_globs | 464 | null | |
nat-n/poethepoet | def test_expr_with_imports(run_poe_subproc):
result = run_poe_subproc("expr_with_imports", project="expr")
assert result.capture == "Poe => bool(re.match(r'^\\S+@\\S+\\.\\S+$', ${EMAIL}))\n"
assert result.stdout == | "True\n" | assert | string_literal | tests/test_expr_task.py | test_expr_with_imports | 62 | null | |
nat-n/poethepoet | from typing import Annotated, Any, TypedDict
import pytest
from poethepoet.exceptions import ConfigValidationError
from poethepoet.options import PoeOptions
from poethepoet.options.annotations import Metadata
def test_dash_case_keys_map_to_attributes_and_get():
"""Config keys using dash-case should map to snake_... | 7 | assert | numeric_literal | tests/options/test_options.py | test_dash_case_keys_map_to_attributes_and_get | 137 | null | |
nat-n/poethepoet | import os
import shutil
import pytest
def _uv_integration_available():
if not shutil.which("uv"):
return False
try:
import socket
sock = socket.create_connection(("pypi.org", 443), timeout=1)
except OSError:
return False
else:
sock.close()
return True
... | 0 | assert | numeric_literal | tests/test_uv_executor.py | test_uv_executor_passes_uv_run_options | 175 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | 50 | assert | numeric_literal | tests/completion/test_bash_completion_harness.py | test_very_long_task_list | TestBashEdgeCases | 1,033 | null |
nat-n/poethepoet | from poethepoet.helpers.command import parse_poe_cmd, resolve_command_tokens
def test_resolve_command_tokens():
line = parse_poe_cmd(
"""
abc${thing1}def *$thing2?
"""
)[0]
assert list(resolve_command_tokens([line], {"thing2": ""})) == [
("abcdef", False),
("*?", Tr... | [ ("one", False), ("two", False), ("three", False), ] | assert | collection | tests/helpers/command/test_command_parsing.py | test_resolve_command_tokens | 75 | null | |
nat-n/poethepoet | poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_setting_default_array_item_task_type(run_poe_subproc):
result = run_poe_subproc(
"composite_task", project="scripts", env={"POETRY_VIRTUALENVS_CREATE": "false"}
)
assert (
result.capture == "Poe => poe_test_echo Hello\nPoe => poe... | "Hello\nWorld!\n" | assert | string_literal | tests/test_poe_config.py | test_setting_default_array_item_task_type | 30 | null | |
nat-n/poethepoet | import os
import shutil
import pytest
def _uv_integration_available():
if not shutil.which("uv"):
return False
try:
import socket
sock = socket.create_connection(("pypi.org", 443), timeout=1)
except OSError:
return False
else:
sock.close()
return True
... | "Poe => echo UV_RUN_RECURSION_DEPTH: $UV_RUN_RECURSION_DEPTH\n" "echo VIRTUAL_ENV: $VIRTUAL_ENV\n" "echo pwd: $(pwd)\n" | assert | string_literal | tests/test_uv_executor.py | test_uv_executor_task_with_cwd | 117 | null | |
nat-n/poethepoet | import uuid
def test_ref_error_on_sequence_with_capture_stdout(run_poe_subproc):
result = run_poe_subproc("capture-sequence", project="refs_error")
assert "Error: Invalid task 'capture-sequence'" in | result.capture | assert | complex_expr | tests/test_ref_task.py | test_ref_error_on_sequence_with_capture_stdout | 119 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
from poethepoet import _escape_choice, _format_help
def test_describe_tasks(run_poe_main):
result = run_poe_main("_describe_tasks")
# expect an ordered listing of non-hidden tasks defined in the dummy_project
assert result.stdout == (
"echo show_env g... | "" | assert | string_literal | tests/completion/test_zsh_completion.py | test_describe_tasks | 131 | null | |
nat-n/poethepoet | poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_decrease_verbosity(run_poe_subproc):
result = run_poe_subproc("-q", "part1", env=poetry_vars)
assert result.capture == ""
assert result.stdout == | "Hello\n" | assert | string_literal | tests/test_poe_config.py | test_decrease_verbosity | 79 | null | |
nat-n/poethepoet | import os
import re
import pytest
def _setup_poetry_project(run_poetry_1, projects):
run_poetry_1(["install"], cwd=projects["poetry_plugin"])
def _setup_poetry_project_empty_prefix(run_poetry_1, projects):
run_poetry_1(
["install"],
cwd=projects["poetry_plugin/empty_prefix"].parent,
)
de... | "Poe => from cowpy import cow; print(list(cow.COWACTERS)[5])\ncheese\n" | assert | string_literal | tests/test_poetry_plugin_v1.py | test_task_with_lib_dependency | 69 | null | |
nat-n/poethepoet | import uuid
def test_ref_passes_named_args_in_definition(run_poe_subproc):
result = run_poe_subproc("greet-dave", project="refs")
assert result.capture == "Poe => poe_test_echo hi dave\n"
assert result.stdout == | "hi dave\n" | assert | string_literal | tests/test_ref_task.py | test_ref_passes_named_args_in_definition | 28 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _powershell_is_available() -> bool:
"""Check if PowerShell is actually available and functional."""
# Check both pwsh (PowerShell Core) and powershell (Windows PowerShell)
for cmd in ("pwsh", "powershell"):
if shutil.which(cmd) is not None:
... | 5 | assert | numeric_literal | tests/completion/test_powershell_completion.py | test_powershell_completion | 43 | null | |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
@pytest.mark.flaky(reruns=3, reruns_delay=1)
def test_sequence_in_parallel_task(run_poe_subproc, delay_factor):
base = 250 * delay_factor
para_delay = 2 * base
seq_delay = base
result = run_poe_subproc(
"parallel_of_sequences", str(para_delay)... | [ f"Poe => poe_test_delayed_echo {para_delay} para1", f"Poe => poe_test_delayed_echo {seq_delay} seq1", "Poe => poe_test_echo seq2", ] | assert | collection | tests/test_parallel_tasks.py | test_sequence_in_parallel_task | 65 | null | |
nat-n/poethepoet | def test_global_envfile_and_default(run_poe_subproc):
result = run_poe_subproc("deploy-dev", project="envfile")
assert | result.capture | assert | complex_expr | tests/test_envfile.py | test_global_envfile_and_default | 3 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | "" | assert | string_literal | tests/completion/test_bash_completion_harness.py | test_task_option_doesnt_set_target_path | TestBashTaskOptionIsolation | 1,522 | null |
nat-n/poethepoet | import os
from pathlib import Path
from shutil import rmtree
import pytest
from poethepoet.scripts import rm
_test_file_tree = {
"pkg": {
"__pycache__": {"foo.pyc": "XXX"},
"foo.py": "XXX",
"bar": {
"baz.py": "XXX",
"__pycache__": {"baz.pyc": "XXX"},
},
... | "No files or directories to delete matching 'nee'\n" "No files or directories to delete matching 'shrubbery'\n" | assert | string_literal | tests/test_scripts.py | test_rm_innert_patterns_verbose | 164 | null | |
nat-n/poethepoet | import pytest
def generate_pyproject(temp_pyproject):
def generator(project_verbosity=0, task_verbosity=0):
def inline_task(inline_verbosity: int) -> str:
return (
'{ cmd = "poe_test_echo inline_task '
+ str(inline_verbosity)
+ ' ${POE_VERBOSITY}"... | "cmd task inheriting default verbosity -1 0\n" "inline_task -2 -2\n" "inline_task -1 -1\n" "inline_task 0 0\n" "inline_task 1 1\n" "inline_task 2 2\n" | assert | string_literal | tests/test_verbosity.py | test_sequence_task_with_verbosity | 167 | null | |
nat-n/poethepoet | poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_setting_default_task_type(run_poe_subproc, projects, esc_prefix):
# Also tests passing of extra_args to sys.argv
result = run_poe_subproc(
"echo-args",
"nat,",
r"welcome to " + esc_prefix + "${POE_ROOT}",
project="scr... | f"hello nat, welcome to {projects['scripts']}\n" | assert | string_literal | tests/test_poe_config.py | test_setting_default_task_type | 19 | null | |
nat-n/poethepoet | import pytest
def generate_choices_pyproject(temp_pyproject):
def generator():
project_tmpl = """
[tool.poe.tasks.check]
cmd = "poe_test_echo ${package}"
[[tool.poe.tasks.check.args]]
name = "package"
positional = true
choices = ["all"... | 0 | assert | numeric_literal | tests/test_arg_choices.py | test_choices_accepts_valid_value | 86 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_parse_params():
tree = parse_poe_cmd(
"""
$x... | "x" | assert | string_literal | tests/helpers/command/test_ast.py | test_parse_params | 53 | null | |
nat-n/poethepoet | import uuid
def test_ref_passes_extra_args_in_definition(run_poe_subproc):
result = run_poe_subproc("greet-funny", project="refs")
assert result.capture == "Poe => poe_test_echo hi 'lol!'\n"
assert result.stdout == | "hi lol!\n" | assert | string_literal | tests/test_ref_task.py | test_ref_passes_extra_args_in_definition | 35 | null | |
nat-n/poethepoet | import uuid
def test_ref_forwards_arguments(run_poe_subproc):
result = run_poe_subproc(
"sorry-dave",
"I",
"cant",
"do",
"that",
"--",
"--",
",",
"anything",
"else?",
project="refs",
)
assert (
result.capture
... | "hi lol! OK\n" | assert | string_literal | tests/test_ref_task.py | test_ref_forwards_arguments | 93 | null | |
nat-n/poethepoet | def test_global_envfile_and_default(run_poe_subproc):
result = run_poe_subproc("test", project="default_value")
assert (
"Poe => poe_test_echo '!one!' '!two!' '!three!' '!four!' '!five!' '!six!'\n"
in result.capture
)
assert result.stdout == | "!one! !two! !three! !four! !five! !six!\n" | assert | string_literal | tests/test_default_value.py | test_global_envfile_and_default | 7 | null | |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
def generate_pyproject(temp_pyproject):
def generator(
delay_factor=1,
seq1_ignore_fail=False,
seq2_ignore_fail=False,
para1_ignore_fail=False,
para2_ignore_fail=False,
):
def fmt_ignore_fail(value):
... | "Great success!\nfailing fast with error\nGreat success!\n" | assert | string_literal | tests/test_parallel_tasks.py | test_parallel_ignore_failures | 315 | null | |
nat-n/poethepoet | import asyncio
import pytest
from poethepoet.helpers.eventloop import async_iter_merge
def _make_async_gen(items, delay: float = 0.001, on_close: asyncio.Event | None = None):
async def _gen():
try:
for item in items:
await asyncio.sleep(delay)
yield item
... | [ 1, 2, 3, ] | assert | collection | tests/helpers/test_eventloop.py | test_aclose_called_on_normal_completion | 41 | null | |
nat-n/poethepoet | EXAMPLE_CONFIG = """
[tool.poe.env]
GLOBAL_POE_ROOT = "${POE_ROOT}"
GLOBAL_POE_PWD = "${POE_PWD}"
[tool.poe.tasks.my-task]
default_item_type = "cmd"
sequence = [
"echo POE_ROOT: ${POE_ROOT}",
"echo GLOBAL_POE_ROOT: ${GLOBAL_POE_ROOT}",
"echo TASK_POE_ROOT: ${TASK_POE_ROOT}",
"echo POE_PWD: ${POE_PWD}",
"echo... | 0 | assert | numeric_literal | tests/test_env_config.py | test_global_env_templating | 26 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | "task1" | assert | string_literal | tests/completion/test_bash_completion_harness.py | test_task_with_digits | TestBashTaskNamePatterns | 1,176 | null |
nat-n/poethepoet | import pytest
def test_subtasks_inherit_cwd_option_as_default(run_poe_subproc, is_windows):
result = run_poe_subproc("all_cwd", project="sequences")
asse | "Poe => os.getcwd()\n" "Poe => os.getcwd()\n" "Poe => 'all_cwd[2]'\n" "Poe => 'all_cwd[3]'\n" | assert | string_literal | tests/test_sequence_tasks.py | test_subtasks_inherit_cwd_option_as_default | 75 | null | |
nat-n/poethepoet | from io import StringIO
import pytest
from poethepoet.helpers.command import parse_poe_cmd
from poethepoet.helpers.command.ast import Glob, PythonGlob, Script
from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError
def test_ast_node_inspection():
tree = parse_poe_cmd(
"""
... | 2 | assert | numeric_literal | tests/helpers/command/test_ast.py | test_ast_node_inspection | 607 | null | |
nat-n/poethepoet | import pytest
def test_sequence_task_with_multiple_value_arg(run_poe_subproc):
result = run_poe_subproc(
"multiple-value-arg", "hey", "1", "2", "3", project="sequences"
)
asse | "Poe => poe_test_echo first: hey\nPoe => poe_test_echo second: '1 2 3'\n" "Poe => poe_test_echo Done.\n" | assert | string_literal | tests/test_sequence_tasks.py | test_sequence_task_with_multiple_value_arg | 65 | null | |
nat-n/poethepoet | import pytest
def test_a_script_sequence_task_with_args(run_poe_subproc, esc_prefix):
# This should be exactly the same as calling the composite_task task directly
result = run_poe_subproc("greet-multiple", "--mouse=Jerry", project="sequences")
asse | """Poe => 'my_package:main(environ.get('"'"'cat'"'"'))'\n""" """Poe => 'my_package:main(environ['"'"'mouse'"'"'])'\n""" | assert | string_literal | tests/test_sequence_tasks.py | test_a_script_sequence_task_with_args | 53 | null | |
nat-n/poethepoet | def test_prefer_valid_pyproject(run_poe_subproc, projects):
# and import the poe_tasks from elsewhere
result = run_poe_subproc(project="poe_tasks_file")
assert (
"Configured tasks:\n"
" main_pyproject \n"
" main_poetasks_toml \n"
" sub1_poetasks_toml \n"
... | "" | assert | string_literal | tests/test_poe_tasks_file.py | test_prefer_valid_pyproject | 15 | null | |
nat-n/poethepoet | import shutil
import pytest
def test_docs_with_included_tasks(run_poe_subproc, projects):
result = run_poe_subproc(project="include_scripts")
asser | result.capture | assert | complex_expr | tests/test_include_scripts.py | test_docs_with_included_tasks | 8 | null | |
nat-n/poethepoet | import re
from poethepoet import __version__
poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_call_with_directory(run_poe, projects):
result = run_poe("--directory", str(projects["example"]), cwd=".")
assert result.code == | 1 | assert | numeric_literal | tests/test_cli.py | test_call_with_directory | 24 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
class TestZshCompletionCaching:
def completion_script(self, run_poe_main):
"""Get the generated zsh completion script."""
result = run_poe_main("_zsh_completion")
return result.stdout
def cache_disabled_script(self, completion_script):
... | 0 | assert | numeric_literal | tests/completion/test_zsh_completion_harness.py | test_cache_key_includes_path | TestZshCompletionCaching | 806 | null |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | task_name | assert | variable | tests/completion/test_bash_completion_harness.py | test_all_valid_task_name_chars | TestBashTaskNamePatterns | 1,318 | null |
nat-n/poethepoet | import shutil
import pytest
def test_shell_task_with_dash_case_arg(run_poe_subproc):
result = run_poe_subproc(
"greet", "--formal-greeting=hey", "--subject=you", project="shells"
)
assert result.capture == ("Poe => poe_test_echo $formal_greeting $subject\n")
assert result.stdout == | "hey you\n" | assert | string_literal | tests/test_shell_task.py | test_shell_task_with_dash_case_arg | 43 | null | |
nat-n/poethepoet | import difflib
no_venv = {"POETRY_VIRTUALENVS_CREATE": "false"}
def test_script_task_with_hard_coded_args(run_poe_subproc, projects, esc_prefix):
result = run_poe_subproc("static-args-test", project="scripts", env=no_venv)
assert result.capture == "Poe => static-args-test\n"
assert result.stdout == (
... | "" | assert | string_literal | tests/test_script_tasks.py | test_script_task_with_hard_coded_args | 26 | null | |
nat-n/poethepoet | from typing import Annotated, Any, TypedDict
import pytest
from poethepoet.exceptions import ConfigValidationError
from poethepoet.options import PoeOptions
from poethepoet.options.annotations import Metadata
def test_list_type_validation_error():
"""Supplying wrong type for a list field should raise ConfigValid... | str(exc.value) | assert | func_call | tests/options/test_options.py | test_list_type_validation_error | 110 | null | |
nat-n/poethepoet | from typing import Annotated, Any, TypedDict
import pytest
from poethepoet.exceptions import ConfigValidationError
from poethepoet.options import PoeOptions
from poethepoet.options.annotations import Metadata
def test_poe_options_basic_parse_and_defaults():
"""Basic parse: provided values are kept; defaults are ... | True | assert | bool_literal | tests/options/test_options.py | test_poe_options_basic_parse_and_defaults | 40 | null | |
nat-n/poethepoet | def test_call_attr_func(run_poe_subproc):
result = run_poe_subproc("deep-graph-with-args", project="graphs")
assert result.capture == (
"Poe => poe_test_echo here we go...\n"
"Poe => :\n"
"Poe <= poe_test_echo about\n"
"Poe <= poe_test_echo hello\n"
"Poe => poe_test_echo ... | "here we go...\nThinking about and\nhello and hello\n" | assert | string_literal | tests/test_graph_execution.py | test_call_attr_func | 11 | null | |
nat-n/poethepoet | def test_call_attr_func(run_poe_subproc):
result = run_poe_subproc("deep-graph-with-args", project="graphs")
assert result.capture == (
"Poe => poe_test_echo here we go...\n"
"Poe => :\n"
"Poe <= poe_test_echo about\n"
"Poe <= poe_test_echo hello\n"
"Poe => poe_test_echo ... | "" | assert | string_literal | tests/test_graph_execution.py | test_call_attr_func | 12 | null | |
nat-n/poethepoet | import sys
import pytest
PY_V = f"{sys.version_info.major}.{sys.version_info.minor}"
@pytest.mark.slow
def test_virtualenv_executor_provides_access_to_venv_content(
run_poe_subproc, with_virtualenv_and_venv, projects
):
# Create a venv containing our special test package
venv_path = projects["venv"].join... | "0.0.99\n" | assert | string_literal | tests/test_executors.py | test_virtualenv_executor_provides_access_to_venv_content | 101 | null | |
nat-n/poethepoet | from collections.abc import Sequence
import pytest
@pytest.mark.flaky(reruns=3, reruns_delay=1)
def test_parallel_in_sequence_task(run_poe_subproc, delay_factor):
base = 50 * delay_factor
seq_delay = 2 * base
para_delay = base
result = run_poe_subproc(
"sequence_of_parallels", str(seq_delay), ... | "seq1\nsequence_of_par… | para2\nsequence_of_par… | para1\n" | assert | string_literal | tests/test_parallel_tasks.py | test_parallel_in_sequence_task | 91 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
def _bash_is_available() -> bool:
"""Check if bash is actually available and functional."""
bash_path = shutil.which("bash")
if bash_path is None:
return False
try:
proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5... | "" | assert | string_literal | tests/completion/test_bash_completion.py | test_bash_completion | 27 | null | |
nat-n/poethepoet | import shutil
import subprocess
import pytest
from poethepoet import _escape_choice, _format_help
def test_zsh_completion(run_poe_main):
result = run_poe_main("_zsh_completion")
# some lines to stdout and none for stderr
assert len(result.stdout.split("\n")) > | 5 | assert | numeric_literal | tests/completion/test_zsh_completion.py | test_zsh_completion | 201 | null | |
nat-n/poethepoet | import os
import signal
import sys
import time
import pytest
def _wait_for_proc_exit(proc, timeout: float = 5.0) -> bool:
"""Wait for a Popen process to exit, return True if it exited."""
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
if proc.poll() is not None:
... | None | assert | none_literal | tests/test_shutdown.py | test_interrupt_terminates_task_and_children | 103 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.