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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ $ uvx usethis ci bitbucket
✔ Writing 'bitbucket-pipelines.yml'.
✔ Adding cache 'uv' definition to 'bitbucket-pipelines.yml'.
✔ Adding 'Run Ruff' to default pipeline in 'bitbucket-pipelines.yml'.
✔ Adding 'Test on 3.12' to default pipeline in 'bitbucket-pipelines.yml'.
✔ Adding 'Test on 3.13' to default pipeline in 'bitbucket-pipelines.yml'.
✔ Adding 'Test on 3.14' to default pipeline in 'bitbucket-pipelines.yml'.
☐ Run your pipeline via the Bitbucket website.
```

Expand Down
2 changes: 1 addition & 1 deletion docs/example-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ $ uvx usethis ci bitbucket
✔ Writing 'bitbucket-pipelines.yml'.
✔ Adding cache 'uv' definition to 'bitbucket-pipelines.yml'.
✔ Adding 'Run Ruff' to default pipeline in 'bitbucket-pipelines.yml'.
✔ Adding 'Test on 3.12' to default pipeline in 'bitbucket-pipelines.yml'.
✔ Adding 'Test on 3.13' to default pipeline in 'bitbucket-pipelines.yml'.
✔ Adding 'Test on 3.14' to default pipeline in 'bitbucket-pipelines.yml'.
☐ Run your pipeline via the Bitbucket website.
```
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _uv_init_dir(tmp_path_factory: pytest.TempPathFactory) -> Path:
"--python",
# Deliberately kept at at a version other than the latest version to
# check range checks e.g. for Bitbucket pipelines matrixes.
"3.12",
"3.13",
"--vcs",
"none",
],
Expand Down
14 changes: 9 additions & 5 deletions tests/usethis/_core/test_core_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,12 @@ def test_mentioned_in_file(
(uv_init_dir / "tests").mkdir()
(uv_init_dir / "tests" / "conftest.py").touch()

# Act
with change_cwd(uv_init_dir), files_manager():
PyprojectTOMLManager()[["project"]]["requires-python"] = (
">=3.12,<3.14"
)

# Act
use_ci_bitbucket()

# Assert
Expand Down Expand Up @@ -473,7 +477,7 @@ def test_unsupported_python_version_removed(self, uv_init_dir: Path):
(uv_init_dir / "pyproject.toml").write_text(
"""\
[project]
requires-python = ">=3.12,<3.13"
requires-python = ">=3.13,<3.14"
"""
)
(uv_init_dir / "bitbucket-pipelines.yml").write_text(
Expand All @@ -482,11 +486,11 @@ def test_unsupported_python_version_removed(self, uv_init_dir: Path):
pipelines:
default:
- step:
name: Test on 3.11
name: Test on 3.12
script:
- echo 'Hello, world!'
- step:
name: Test on 3.12
name: Test on 3.13
script:
- echo 'Hello, world!'
"""
Expand All @@ -498,7 +502,7 @@ def test_unsupported_python_version_removed(self, uv_init_dir: Path):

# Assert
contents = (uv_init_dir / "bitbucket-pipelines.yml").read_text()
assert "Test on 3.11" not in contents
assert "Test on 3.12" not in contents

class TestRemove:
class TestPyproject:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_dump_file(self, tmp_path: Path):
# Assert
assert result == contents

def test_file_not_exists(self, uv_init_dir: Path):
def test_file_doesnt_exist(self, uv_init_dir: Path):
# If the file does not exist, we should construct based on information in
# the repo.

Expand All @@ -46,7 +46,7 @@ def test_file_not_exists(self, uv_init_dir: Path):
PyprojectTOMLManager().set_value(
keys=["tool", "coverage", "xml", "output"], value="coverage.xml"
)
uv_python_pin("3.12")
uv_python_pin("3.13")
content = (uv_init_dir / "pyproject.toml").read_text()
assert "xml" in content

Expand All @@ -60,7 +60,7 @@ def test_file_not_exists(self, uv_init_dir: Path):
== """\
sonar.projectKey=foobar
sonar.language=py
sonar.python.version=3.12
sonar.python.version=3.13
sonar.sources=./src
sonar.tests=./tests
sonar.python.coverage.reportPaths=coverage.xml
Expand Down
1 change: 1 addition & 0 deletions tests/usethis/_tool/impl/test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class TestUpdateBitbucketSteps:
def test_new_file(self, uv_init_dir: Path, capfd: pytest.CaptureFixture[str]):
with change_cwd(uv_init_dir), files_manager():
# Arrange
PyprojectTOMLManager()[["project"]]["requires-python"] = ">=3.12,<3.14"
add_placeholder_step_in_default(report_placeholder=False)
(uv_init_dir / "pytest.ini").touch()

Expand Down
2 changes: 1 addition & 1 deletion tests/usethis/_ui/interface/test_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_readme_example(self, tmp_path: Path):
(tmp_path / "pyproject.toml").write_text(
"""\
[project]
requires-python = ">=3.12"
requires-python = ">=3.12,<3.14"
"""
)

Expand Down
4 changes: 4 additions & 0 deletions tests/usethis/_ui/interface/test_interface_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typer.testing import CliRunner

from usethis._config import usethis_config
from usethis._integrations.file.pyproject_toml.io_ import PyprojectTOMLManager
from usethis._test import change_cwd
from usethis._ui.app import app as main_app
from usethis._ui.interface.ci import app
Expand Down Expand Up @@ -46,6 +47,9 @@ def test_maximal_config(self, uv_init_repo_dir: Path):
runner = CliRunner()
with change_cwd(uv_init_repo_dir):
# Arrange
with PyprojectTOMLManager() as mgr:
mgr[["project"]]["requires-python"] = ">=3.12,<3.14"

for tool_command in ALL_TOOL_COMMANDS:
if not usethis_config.offline:
result = runner.invoke(main_app, ["tool", tool_command])
Expand Down