Skip to content
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
8 changes: 4 additions & 4 deletions src/usethis/_core/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from usethis._console import how_print, info_print
from usethis._integrations.ci.bitbucket.config import (
add_bitbucket_pipeline_config,
remove_bitbucket_pipeline_config,
add_bitbucket_pipelines_config,
remove_bitbucket_pipelines_config,
)
from usethis._tool.impl.codespell import CodespellTool
from usethis._tool.impl.deptry import DeptryTool
Expand Down Expand Up @@ -37,7 +37,7 @@ def use_ci_bitbucket(*, remove: bool = False, how: bool = False) -> None:
or use_codespell
)

add_bitbucket_pipeline_config(report_placeholder=not use_any_tool)
add_bitbucket_pipelines_config(report_placeholder=not use_any_tool)

if use_pre_commit:
PreCommitTool().update_bitbucket_steps()
Expand All @@ -54,7 +54,7 @@ def use_ci_bitbucket(*, remove: bool = False, how: bool = False) -> None:

print_how_to_use_ci_bitbucket()
else:
remove_bitbucket_pipeline_config()
remove_bitbucket_pipelines_config()


def print_how_to_use_ci_bitbucket() -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/usethis/_integrations/ci/bitbucket/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from usethis._integrations.ci.bitbucket.steps import add_placeholder_step_in_default


def add_bitbucket_pipeline_config(report_placeholder: bool = True) -> None:
def add_bitbucket_pipelines_config(report_placeholder: bool = True) -> None:
"""Add a Bitbucket pipeline configuration.

Note that the pipeline is empty and will need steps added to it to run successfully.
Expand All @@ -15,7 +15,7 @@ def add_bitbucket_pipeline_config(report_placeholder: bool = True) -> None:
add_placeholder_step_in_default(report_placeholder=report_placeholder)


def remove_bitbucket_pipeline_config() -> None:
def remove_bitbucket_pipelines_config() -> None:
if not (usethis_config.cpd() / "bitbucket-pipelines.yml").exists():
# Early exit; the file already doesn't exist
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from usethis._integrations.ci.bitbucket.anchor import ScriptItemAnchor
from usethis._integrations.ci.bitbucket.config import (
add_bitbucket_pipeline_config,
remove_bitbucket_pipeline_config,
add_bitbucket_pipelines_config,
remove_bitbucket_pipelines_config,
)
from usethis._integrations.ci.bitbucket.schema import Model, Script
from usethis._integrations.ci.bitbucket.steps import (
Expand All @@ -18,7 +18,7 @@
class TestAddBitbucketPipelineConfig:
def test_blank_slate(self, uv_init_dir: Path):
with change_cwd(uv_init_dir), PyprojectTOMLManager():
add_bitbucket_pipeline_config()
add_bitbucket_pipelines_config()

assert (uv_init_dir / "bitbucket-pipelines.yml").exists()
content = (uv_init_dir / "bitbucket-pipelines.yml").read_text()
Expand Down Expand Up @@ -50,7 +50,7 @@ def test_existing_file(self, tmp_path: Path):
(tmp_path / "bitbucket-pipelines.yml").write_text("existing content")

with change_cwd(tmp_path):
add_bitbucket_pipeline_config()
add_bitbucket_pipelines_config()

assert (tmp_path / "bitbucket-pipelines.yml").exists()
content = (tmp_path / "bitbucket-pipelines.yml").read_text()
Expand All @@ -59,7 +59,7 @@ def test_existing_file(self, tmp_path: Path):
def test_satisfies_schema(self, uv_init_dir: Path):
# Act
with change_cwd(uv_init_dir), PyprojectTOMLManager():
add_bitbucket_pipeline_config()
add_bitbucket_pipelines_config()
add_bitbucket_step_in_default(
Step(
name="Example step",
Expand All @@ -77,14 +77,14 @@ def test_satisfies_schema(self, uv_init_dir: Path):
class TestRemoveBitbucketPipelineConfig:
def test_blank_slate(self, tmp_path: Path):
with change_cwd(tmp_path):
remove_bitbucket_pipeline_config()
remove_bitbucket_pipelines_config()

assert not (tmp_path / "bitbucket-pipelines.yml").exists()

def test_existing_file(self, tmp_path: Path):
(tmp_path / "bitbucket-pipelines.yml").touch()

with change_cwd(tmp_path):
remove_bitbucket_pipeline_config()
remove_bitbucket_pipelines_config()

assert not (tmp_path / "bitbucket-pipelines.yml").exists()
8 changes: 4 additions & 4 deletions tests/usethis/_integrations/ci/bitbucket/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
get_cache_by_name,
remove_cache,
)
from usethis._integrations.ci.bitbucket.config import add_bitbucket_pipeline_config
from usethis._integrations.ci.bitbucket.config import add_bitbucket_pipelines_config
from usethis._integrations.ci.bitbucket.schema import Cache, CachePath
from usethis._integrations.file.pyproject_toml.io_ import PyprojectTOMLManager
from usethis._test import change_cwd
Expand All @@ -19,7 +19,7 @@ def test_in_caches(self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]):
cache_by_name = {"example": Cache(CachePath("~/.cache/example"))}

with change_cwd(uv_init_dir), PyprojectTOMLManager():
add_bitbucket_pipeline_config()
add_bitbucket_pipelines_config()
capfd.readouterr()

# Act
Expand All @@ -42,7 +42,7 @@ def test_already_exists(self, uv_init_dir: Path):

# Act
with change_cwd(uv_init_dir), PyprojectTOMLManager():
add_bitbucket_pipeline_config()
add_bitbucket_pipelines_config()
add_caches(cache_by_name)

# Assert
Expand Down Expand Up @@ -125,7 +125,7 @@ def test_removal_succeeds(self, tmp_path: Path, capfd: pytest.CaptureFixture[str
def test_roundtrip(self, uv_init_dir: Path):
with change_cwd(uv_init_dir), PyprojectTOMLManager():
# Arrange
add_bitbucket_pipeline_config()
add_bitbucket_pipelines_config()
add_caches({"mycache": Cache(CachePath("~/.cache/mytool"))})

# Act
Expand Down