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

[pre-commit.ci] pre-commit autoupdate #149

Merged
merged 2 commits into from
Aug 19, 2024
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.18
rev: v0.19
hooks:
- id: validate-pyproject

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
4 changes: 2 additions & 2 deletions python/tests/bootstrap/test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
SAMPLE_USER_KEY = str(Path(mockssh.__file__).parent / "sample-user-key")


@pytest.fixture()
@pytest.fixture
def ssh_server() -> Generator[mockssh.Server, None, None]:
users = {"test": SAMPLE_USER_KEY}
with mockssh.Server(users) as s:
yield s


@pytest.fixture()
@pytest.fixture
def ssh_client(ssh_server: mockssh.Server) -> SSHClient:
return ssh_server.client(0) # type: ignore[no-any-return]

Expand Down
4 changes: 2 additions & 2 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def local_env() -> LocalEnvironment:


@pytest.fixture(scope="session")
@pytest.mark.linux()
@pytest.mark.linux
def linux_local_env() -> LocalEnvironment:
return LocalEnvironment()

Expand All @@ -91,7 +91,7 @@ def agent_env(agent_binary_host: str) -> Generator[AgentEnvironment, None, None]


@pytest.fixture(scope="session")
@pytest.mark.docker()
@pytest.mark.docker
def docker_client() -> docker.DockerClient:
try:
client = docker.from_env()
Expand Down
6 changes: 3 additions & 3 deletions python/tests/test_busybox.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from binharness import Environment


@pytest.mark.linux()
@pytest.mark.linux
def test_busybox_injection(env: Environment) -> None:
busybox_injection = BusyboxInjection()
busybox_injection.install(env)
Expand All @@ -28,7 +28,7 @@ def test_busybox_injection(env: Environment) -> None:
assert stdout == b"one\n"


@pytest.mark.linux()
@pytest.mark.linux
def test_busbox_injection_mktemp(env: Environment) -> None:
busybox_injection = BusyboxInjection()
busybox_injection.install(env)
Expand All @@ -37,7 +37,7 @@ def test_busbox_injection_mktemp(env: Environment) -> None:


# TODO: Make this work on agents, probably an issue in wait()
@pytest.mark.linux()
@pytest.mark.linux
def test_nc_interaction(local_env: Environment) -> None:
busybox = BusyboxInjection()
busybox.install(local_env)
Expand Down
6 changes: 3 additions & 3 deletions python/tests/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_get_tempdir(local_env: Environment) -> None:


# TODO: Need to think about how to test these with non-linux environments
@pytest.mark.linux()
@pytest.mark.linux
def test_stdout(env: Environment) -> None:
busybox = BusyboxInjection()
busybox.install(env)
Expand All @@ -48,7 +48,7 @@ def test_stdout(env: Environment) -> None:
assert proc.stdout.read() == b"hello\n"


@pytest.mark.linux()
@pytest.mark.linux
def test_stderr(env: Environment) -> None:
busybox = BusyboxInjection()
busybox.install(env)
Expand All @@ -57,7 +57,7 @@ def test_stderr(env: Environment) -> None:
assert proc.stderr.read() == b"hello\n"


@pytest.mark.linux()
@pytest.mark.linux
def test_process_poll(env: Environment) -> None:
busybox = BusyboxInjection()
busybox.install(env)
Expand Down
4 changes: 2 additions & 2 deletions python/tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from binharness.common.busybox import BusyboxShellExecutor


@pytest.mark.linux()
@pytest.mark.linux
def test_busybox_injection_without_install(env: Environment) -> None:
target = Target(env, Path("/usr/bin/true"))
busybox_shell = BusyboxShellExecutor()
Expand All @@ -23,7 +23,7 @@ def test_busybox_injection_without_install(env: Environment) -> None:


# TODO: Maybe LocalEnvironment objects should be interchangable?
@pytest.mark.linux()
@pytest.mark.linux
def test_busybox_injection_different_environment() -> None:
env1 = LocalEnvironment()
env2 = LocalEnvironment()
Expand Down
8 changes: 4 additions & 4 deletions python/tests/test_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
from binharness.types.environment import Environment


@pytest.mark.linux()
@pytest.mark.linux
def test_inject_true(env: Environment) -> None:
true_injection = Injection(Path("/usr/bin/true"))
true_injection.install(env)
assert true_injection.env_path is not None
assert stat.S_ISREG(env.stat(true_injection.env_path).mode)


@pytest.mark.linux()
@pytest.mark.linux
def test_inject_true_executable(env: Environment) -> None:
true_injection = ExecutableInjection(Path("/usr/bin/true"))
true_injection.install(env)
Expand All @@ -36,15 +36,15 @@ def test_inject_true_executable(env: Environment) -> None:
assert true_injection.run().wait() == 0


@pytest.mark.linux()
@pytest.mark.linux
def test_inject_true_executable_twice(env: Environment) -> None:
true_injection = ExecutableInjection(Path("/usr/bin/true"))
true_injection.install(env)
with pytest.raises(InjectionAlreadyInstalledError):
true_injection.install(env)


@pytest.mark.linux()
@pytest.mark.linux
def test_inject_two_true_executables(env: Environment) -> None:
true_injection_1 = ExecutableInjection(Path("/usr/bin/true"))
true_injection_1.install(env)
Expand Down
4 changes: 2 additions & 2 deletions python/tests/test_qemu_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from binharness.common.qemu import QemuExecutor


@pytest.mark.linux()
@pytest.mark.linux
def test_run_true(env: Environment) -> None:
target = Target(env, Path("/bin/true"))
qemu = QemuExecutor()
qemu.install(env)
assert qemu.run_target(target).wait() == 0


@pytest.mark.linux()
@pytest.mark.linux
def test_run_strace(env: Environment) -> None:
target = Target(env, Path("/bin/true"))
qemu = QemuExecutor()
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_target_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_run_target(env: Environment) -> None:
assert proc.wait() == 0


@pytest.mark.linux()
@pytest.mark.linux
def test_run_target_busybox(env: Environment) -> None:
target = Target(env, Path("true"))
executor = BusyboxShellExecutor()
Expand Down