Skip to content

Commit

Permalink
fix tests that fail in the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Tattoo committed Oct 19, 2023
1 parent 6c4a267 commit 408580b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ runs:
- name: Run tests
shell: ${{ inputs.terminal }}
run: |
invoke test
invoke test --verbose=3
7 changes: 5 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ def install(context, package=None):
'multiple times to select several targets. See more: '
'https://github.com/CleanCut/green/blob/master/cli-options.txt#L5',
})
def utest(context, test=None):
run(f'green {" ".join(test) if test else UNIT_TESTS}',
def utest(context, test=None, verbose=0):
verbosity = 'v'*verbose
if verbosity:
verbosity = '-' + verbosity
run(f'green {" ".join(test) if test else UNIT_TESTS} {verbosity}',
env={'PYTHONPATH': str(SRCPATH)},
pty=(not system() == 'Windows'))

Expand Down
13 changes: 11 additions & 2 deletions tests/utest/zap/test_zap_cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import sys

from unittest import TestCase
from unittest.mock import ANY, Mock, create_autospec, patch

from robot.running.model import TestSuite

from oxygen.oxygen import OxygenCLI
from ..helpers import RESOURCES_PATH
from ..helpers import get_config, RESOURCES_PATH


class TestOxygenZapCLI(TestCase):
Expand All @@ -16,6 +19,12 @@ def setUp(self):
self.mock = Mock()
self.mock.running.build_suite = Mock(return_value=self.expected_suite)

def tearDown(self):
self.cli = None
self.handler = None
self.expected_suite = None
self.mock = None

def test_cli(self):
self.assertEqual(
self.handler.cli(),
Expand Down Expand Up @@ -81,7 +90,7 @@ def test_cli_run_with_accepted_risk_level(self, mock_robot_iface):
def test_cli_run_with_required_confidence_level(self, mock_robot_iface):
mock_robot_iface.return_value = self.mock

cmd_args = f"oxygen oxygen.zap {self.ZAP_XML} " "--required-confidence-level 3"
cmd_args = f"oxygen oxygen.zap {self.ZAP_XML} --required-confidence-level 3"
with patch.object(sys, "argv", cmd_args.split()):
self.cli.run()

Expand Down

0 comments on commit 408580b

Please sign in to comment.