File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+
3+ from typer .testing import CliRunner
4+
5+ from usethis ._interface .ci import app
6+ from usethis ._test import change_cwd
7+
8+
9+ class TestBitbucket :
10+ def test_add (self , tmp_path : Path ):
11+ # Act
12+ runner = CliRunner ()
13+ with change_cwd (tmp_path ):
14+ result = runner .invoke (
15+ app , # The CI menu only has 1 command (bitbucket
16+ # pipelines) so we skip the subcommand here
17+ )
18+
19+ # Assert
20+ assert result .exit_code == 0 , result .output
21+ assert (tmp_path / "bitbucket-pipelines.yml" ).exists ()
22+
23+ def test_remove (self , tmp_path : Path ):
24+ # Arrange
25+ (tmp_path / "bitbucket-pipelines.yml" ).write_text ("" )
26+
27+ # Act
28+ runner = CliRunner ()
29+ with change_cwd (tmp_path ):
30+ result = runner .invoke (
31+ app , ["--remove" ]
32+ ) # The CI menu only has 1 command (bitbucket
33+ # pipelines) so we skip the subcommand here
34+
35+ # Assert
36+ assert result .exit_code == 0 , result .output
37+ assert not (tmp_path / "bitbucket-pipelines.yml" ).exists ()
Original file line number Diff line number Diff line change @@ -60,6 +60,17 @@ def test_cli_fail(self, uv_init_repo_dir: Path):
6060 pytest .fail ("Expected subprocess.CalledProcessError" )
6161
6262
63+ class TestRequirementsTxt :
64+ def test_runs (self , tmp_path : Path ):
65+ # Act
66+ runner = CliRunner ()
67+ with change_cwd (tmp_path ):
68+ result = runner .invoke (app , ["requirements.txt" ])
69+
70+ # Assert
71+ assert result .exit_code == 0 , result .output
72+
73+
6374class TestRuff :
6475 @pytest .mark .usefixtures ("_vary_network_conn" )
6576 def test_cli (self , uv_init_dir : Path ):
You can’t perform that action at this time.
0 commit comments