Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Dec 3, 2024
1 parent 7b76677 commit aab4891
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pytest_reportportal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def __init__(self, pytest_config: Config) -> None:
"""Initialize required attributes."""
self.rp_rerun = (pytest_config.option.rp_rerun or pytest_config.getini('rp_rerun'))
self.rp_endpoint = self.find_option(pytest_config, 'rp_endpoint')
self.rp_hierarchy_code = self.find_option(pytest_config, 'rp_hierarchy_code')
self.rp_hierarchy_code = to_bool(self.find_option(pytest_config, 'rp_hierarchy_code'))
self.rp_dir_level = int(self.find_option(pytest_config, 'rp_hierarchy_dirs_level'))
self.rp_hierarchy_dirs = self.find_option(pytest_config, 'rp_hierarchy_dirs')
self.rp_hierarchy_test_file = self.find_option(pytest_config, 'rp_hierarchy_test_file')
self.rp_hierarchy_dirs = to_bool(self.find_option(pytest_config, 'rp_hierarchy_dirs'))
self.rp_dir_path_separator = self.find_option(pytest_config, 'rp_hierarchy_dir_path_separator')
self.rp_hierarchy_test_file = to_bool(self.find_option(pytest_config, 'rp_hierarchy_test_file'))
self.rp_ignore_attributes = set(self.find_option(pytest_config, 'rp_ignore_attributes') or [])
self.rp_is_skipped_an_issue = self.find_option(pytest_config, 'rp_is_skipped_an_issue')
self.rp_issue_id_marks = self.find_option(pytest_config, 'rp_issue_id_marks')
Expand Down
2 changes: 1 addition & 1 deletion pytest_reportportal/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def add_shared_option(name, help_str, default=None, action='store'):
'rp_hierarchy_test_file',
default=True,
type='bool',
help='Show file name in hierarchy. Depends on rp_hierarchy_dirs_level to get deep enough')
help='Show file name in hierarchy')
parser.addini(
'rp_issue_system_url',
default='',
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def getoption_side_effect(name, default=None):
mocked_config.option.rp_launch_uuid_print_output = 'STDOUT'
mocked_config.option.rp_client_type = 'SYNC'
mocked_config.option.rp_report_fixtures = 'False'
mocked_config.option.rp_hierarchy_code = 'False'
mocked_config.option.rp_hierarchy_dirs = 'False'
mocked_config.option.rp_hierarchy_test_file = 'True'
mocked_config.option.rp_skip_connection_test = 'False'
return mocked_config


Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def test_logger_handle_attachment(mock_handler, logger, log_level):
log_call("Some {} message".format(log_level), attachment=attachment)
expect(mock_handler.call_count == 1,
'logger.handle called more than 1 time')
expect(getattr(mock_handler.call_args[0][0], "attachment") == attachment,
'record.attachment in args doesn\'t match real value')
expect(getattr(mock_handler.call_args[0][0], 'attachment') == attachment,
"record.attachment in args doesn't match real value")
assert_expectations()


Expand Down Expand Up @@ -327,6 +327,7 @@ def test_pytest_sessionfinish(mocked_session):

def test_pytest_addoption_adds_correct_ini_file_arguments():
"""Test the correct list of options are available in the .ini file."""
mock_parser = mock.MagicMock(spec=Parser)
expected_argument_names = (
'rp_launch',
'rp_launch_id',
Expand All @@ -353,8 +354,8 @@ def test_pytest_addoption_adds_correct_ini_file_arguments():
'rp_hierarchy_code',
'rp_hierarchy_dirs_level',
'rp_hierarchy_dirs',
'rp_display_suite_test_file',
'rp_hierarchy_dir_path_separator',
'rp_hierarchy_test_file',
'rp_issue_system_url',
'rp_bts_issue_url',
'rp_bts_project',
Expand All @@ -370,7 +371,6 @@ def test_pytest_addoption_adds_correct_ini_file_arguments():
'rp_read_timeout',
'rp_report_fixtures'
)
mock_parser = mock.MagicMock(spec=Parser)

pytest_addoption(mock_parser)

Expand Down

0 comments on commit aab4891

Please sign in to comment.