-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: formats test_ssp.py and adds test for check_only in bot.run
Signed-off-by: Jennifer Power <[email protected]>
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[flake8] | ||
max-line-length=100 | ||
max-line-length=105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
import os | ||
from typing import Tuple | ||
|
||
import pytest | ||
from git.repo import Repo | ||
|
||
import trestlebot.bot as bot | ||
|
@@ -201,3 +202,30 @@ def test_empty_commit(tmp_repo: Tuple[str, Repo]) -> None: | |
assert commit_sha == "" | ||
|
||
clean(repo_path, repo) | ||
|
||
|
||
def test_run_check_only(tmp_repo: Tuple[str, Repo]) -> None: | ||
"""Test bot run with check_only""" | ||
repo_path, repo = tmp_repo | ||
|
||
# Create a test file | ||
test_file_path = os.path.join(repo_path, "test.txt") | ||
with open(test_file_path, "w") as f: | ||
f.write("Test content") | ||
|
||
with pytest.raises( | ||
bot.RepoException, | ||
match="Check only mode is enable and diff detected. Manual intervention on main is required.", | ||
): | ||
_ = bot.run( | ||
working_dir=repo_path, | ||
branch="main", | ||
commit_name="Test User", | ||
commit_email="[email protected]", | ||
commit_message="Test commit message", | ||
author_name="The Author", | ||
author_email="[email protected]", | ||
patterns=["*.txt"], | ||
dry_run=True, | ||
check_only=True, | ||
) |