Skip to content

Commit

Permalink
Added gh actions skip
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Feb 27, 2024
1 parent 1396f38 commit b72dac5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_bug_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def setUp(self, mock_runnable):
self.bug_finder = BugFinder(mock_runnable)
self.mock_runnable = mock_runnable

def skip_if_github_actions(reason):
"""Skip a test if running on GitHub Actions."""
if os.getenv("GITHUB_ACTIONS") == "true":
return unittest.skip(reason)
return lambda func: func

def test_find_bugs_function(self):
"""Test case for the find_bugs method when the input is a function."""
code = "def test():\n pass"
Expand Down Expand Up @@ -58,6 +64,7 @@ def test_fix_bugs_class(self):
self.bug_finder.fix_bugs("test.py", code, classname=classname, language=language)
self.mock_runnable.invoke.assert_called_once()

@skip_if_github_actions("This test case is skipped because it requires an OpenAI API key.")
def test_fix_bugs_code(self):
"""Test case for the fix_bugs method when the input is a code snippet."""
code = "print('Hello, World!')"
Expand Down

0 comments on commit b72dac5

Please sign in to comment.