Skip to content

Commit 4567562

Browse files
authored
deps: libvcs 0.30.0 -> 0.33.0 (test performance improved)
# Problem Git, Subversion, and Mercurial repositories are unnecessarily reinitialized for each test via libvcs' pytest plugin. - We're not utilizing session-based scoping. - A single initial repo could be created, then copied to [`tmp_path`](https://docs.pytest.org/en/8.3.x/how-to/tmp_path.html#the-tmp-path-fixture) using [`shutil.copytree`](https://docs.python.org/3/library/shutil.html#shutil.copytree) ([source](https://github.com/python/cpython/blob/v3.13.0/Lib/shutil.py#L550-L605)). # Improvement ``` ❯ hyperfine \ --warmup 3 \ --runs 10 \ --prepare 'pip uninstall -y libvcs && pip install "libvcs==0.30.1"' \ --command-name 'libvcs 0.30.1' \ 'py.test' \ --prepare 'pip uninstall -y libvcs && pip install "libvcs==0.31.0"' \ --command-name 'libvcs 0.31.0' \ 'py.test' \ --prepare 'pip uninstall -y libvcs && pip install "libvcs==0.32.1"' \ --command-name 'libvcs 0.32.1' \ 'py.test' Benchmark 1: libvcs 0.30.1 Time (mean ± σ): 4.784 s ± 0.116 s [User: 4.641 s, System: 0.846 s] Range (min … max): 4.599 s … 4.971 s 10 runs Benchmark 2: libvcs 0.31.0 Time (mean ± σ): 3.436 s ± 0.115 s [User: 2.821 s, System: 0.470 s] Range (min … max): 3.347 s … 3.678 s 10 runs Benchmark 3: libvcs 0.32.1 Time (mean ± σ): 3.173 s ± 0.054 s [User: 2.726 s, System: 0.388 s] Range (min … max): 3.104 s … 3.295 s 10 runs Summary libvcs 0.32.1 ran 1.08 ± 0.04 times faster than libvcs 0.31.0 1.51 ± 0.04 times faster than libvcs 0.30.1 ``` # Changes ## libvcs 0.30.1 -> 0.32.1 See also: - https://github.com/vcs-python/libvcs/blob/v0.32.1/CHANGES#libvcs-0310-2024-10-12 - https://libvcs.git-pull.com/history.html#libvcs-0-32-1-2024-10-12 # Appendix - vcs-python/libvcs#472
2 parents 2bcc550 + f2bead6 commit 4567562

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

CHANGES

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ $ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force
2727

2828
Added Python 3.13 to package trove classifiers and CI tests.
2929

30+
#### libvcs 0.30.1 -> 0.33.0 (#453)
31+
32+
Faster, cached pytest fixtures. Upstream tests are 50% faster.
33+
34+
- https://github.com/vcs-python/libvcs/blob/v0.32.1/CHANGES#libvcs-0310-2024-10-12
35+
- https://libvcs.git-pull.com/history.html#libvcs-0-32-1-2024-10-12
36+
37+
#### Faster tests fixtures (#453)
38+
39+
libvcs's included test fixtures beyond v0.31.0+ are 33%+ faster.
40+
3041
## vcspull v1.31.0 (2024-06-18)
3142

3243
### Breaking changes

conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def xdg_config_path(
5656
return p
5757

5858

59-
@pytest.fixture()
59+
@pytest.fixture
6060
def config_path(
6161
xdg_config_path: pathlib.Path,
6262
request: pytest.FixtureRequest,
@@ -81,7 +81,7 @@ def set_xdg_config_path(
8181
monkeypatch.setenv("XDG_CONFIG_HOME", str(xdg_config_path))
8282

8383

84-
@pytest.fixture()
84+
@pytest.fixture
8585
def repos_path(user_path: pathlib.Path, request: pytest.FixtureRequest) -> pathlib.Path:
8686
"""Return temporary directory for repository checkout guaranteed unique."""
8787
path = user_path / "repos"

poetry.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ vcspull = 'vcspull:cli.cli'
6262

6363
[tool.poetry.dependencies]
6464
python = "^3.9"
65-
libvcs = "~0.30.1"
65+
libvcs = "~0.33.0"
6666
colorama = ">=0.3.9"
6767
PyYAML = "^6.0"
6868

tests/test_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __call__(
2424
...
2525

2626

27-
@pytest.fixture()
27+
@pytest.fixture
2828
def load_yaml(tmp_path: pathlib.Path) -> LoadYAMLFn:
2929
"""Return a yaml loading function that uses temporary directory path."""
3030

tests/test_config_file.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
from .helpers import EnvironmentVarGuard, load_raw, write_config
1616

1717

18-
@pytest.fixture()
18+
@pytest.fixture
1919
def yaml_config(config_path: pathlib.Path) -> pathlib.Path:
2020
"""Ensure and return vcspull yaml configuration file path."""
2121
yaml_file = config_path / "repos1.yaml"
2222
yaml_file.touch()
2323
return yaml_file
2424

2525

26-
@pytest.fixture()
26+
@pytest.fixture
2727
def json_config(config_path: pathlib.Path) -> pathlib.Path:
2828
"""Ensure and return vcspull json configuration file path."""
2929
json_file = config_path / "repos2.json"

tests/test_sync.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ def test_config_variations(
146146
remote_list: list[str],
147147
) -> None:
148148
"""Test vcspull sync'ing across a variety of configurations."""
149-
dummy_repo_name = "dummy_repo"
150-
dummy_repo = create_git_remote_repo(remote_repo_name=dummy_repo_name)
149+
dummy_repo = create_git_remote_repo()
151150

152151
config_file = write_config_remote(
153152
config_path=tmp_path / "myrepos.yaml",
@@ -252,11 +251,10 @@ def test_updating_remote(
252251
has_extra_remotes: bool,
253252
) -> None:
254253
"""Verify yaml configuration state is applied and reflected to local VCS clone."""
255-
dummy_repo_name = "dummy_repo"
256-
dummy_repo = create_git_remote_repo(remote_repo_name=dummy_repo_name)
254+
dummy_repo = create_git_remote_repo()
257255

258256
mirror_name = "mirror_repo"
259-
mirror_repo = create_git_remote_repo(remote_repo_name=mirror_name)
257+
mirror_repo = create_git_remote_repo()
260258

261259
repo_parent = tmp_path / "study" / "myrepo"
262260
repo_parent.mkdir(parents=True)

0 commit comments

Comments
 (0)