Skip to content

Commit

Permalink
testsuite/benchmark.py - 'cmd' -> 'cmd_fixture'
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtedde committed Jul 13, 2023
1 parent f502941 commit b2d8210
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions src/borg/testsuite/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import pytest

from .archiver import changedir, cmd
from .archiver import changedir, cmd_fixture
from .item import Item
from ..constants import zeros

Expand All @@ -28,8 +28,8 @@ def repo_url(request, tmpdir, monkeypatch):


@pytest.fixture(params=["none", "repokey-aes-ocb"])
def repo(request, cmd, repo_url):
cmd(f"--repo={repo_url}", "rcreate", "--encryption", request.param)
def repo(request, cmd_fixture, repo_url):
cmd_fixture(f"--repo={repo_url}", "rcreate", "--encryption", request.param)
return repo_url


Expand Down Expand Up @@ -59,55 +59,59 @@ def data(size):


@pytest.fixture(params=["none", "lz4"])
def repo_archive(request, cmd, repo, testdata):
def repo_archive(request, cmd_fixture, repo, testdata):
archive = "test"
cmd(f"--repo={repo}", "create", "--compression", request.param, archive, testdata)
cmd_fixture(f"--repo={repo}", "create", "--compression", request.param, archive, testdata)
return repo, archive


def test_create_none(benchmark, cmd, repo, testdata):
result, out = benchmark.pedantic(cmd, (f"--repo={repo}", "create", "--compression", "none", "test", testdata))
def test_create_none(benchmark, cmd_fixture, repo, testdata):
result, out = benchmark.pedantic(
cmd_fixture, (f"--repo={repo}", "create", "--compression", "none", "test", testdata)
)
assert result == 0


def test_create_lz4(benchmark, cmd, repo, testdata):
result, out = benchmark.pedantic(cmd, (f"--repo={repo}", "create", "--compression", "lz4", "test", testdata))
def test_create_lz4(benchmark, cmd_fixture, repo, testdata):
result, out = benchmark.pedantic(
cmd_fixture, (f"--repo={repo}", "create", "--compression", "lz4", "test", testdata)
)
assert result == 0


def test_extract(benchmark, cmd, repo_archive, tmpdir):
def test_extract(benchmark, cmd_fixture, repo_archive, tmpdir):
repo, archive = repo_archive
with changedir(str(tmpdir)):
result, out = benchmark.pedantic(cmd, (f"--repo={repo}", "extract", archive))
result, out = benchmark.pedantic(cmd_fixture, (f"--repo={repo}", "extract", archive))
assert result == 0


def test_delete(benchmark, cmd, repo_archive):
def test_delete(benchmark, cmd_fixture, repo_archive):
repo, archive = repo_archive
result, out = benchmark.pedantic(cmd, (f"--repo={repo}", "delete", "-a", archive))
result, out = benchmark.pedantic(cmd_fixture, (f"--repo={repo}", "delete", "-a", archive))
assert result == 0


def test_list(benchmark, cmd, repo_archive):
def test_list(benchmark, cmd_fixture, repo_archive):
repo, archive = repo_archive
result, out = benchmark(cmd, f"--repo={repo}", "list", archive)
result, out = benchmark(cmd_fixture, f"--repo={repo}", "list", archive)
assert result == 0


def test_info(benchmark, cmd, repo_archive):
def test_info(benchmark, cmd_fixture, repo_archive):
repo, archive = repo_archive
result, out = benchmark(cmd, f"--repo={repo}", "info", "-a", archive)
result, out = benchmark(cmd_fixture, f"--repo={repo}", "info", "-a", archive)
assert result == 0


def test_check(benchmark, cmd, repo_archive):
def test_check(benchmark, cmd_fixture, repo_archive):
repo, archive = repo_archive
result, out = benchmark(cmd, f"--repo={repo}", "check")
result, out = benchmark(cmd_fixture, f"--repo={repo}", "check")
assert result == 0


def test_help(benchmark, cmd):
result, out = benchmark(cmd, "help")
def test_help(benchmark, cmd_fixture):
result, out = benchmark(cmd_fixture, "help")
assert result == 0


Expand Down

0 comments on commit b2d8210

Please sign in to comment.