Skip to content

Commit aab4891

Browse files
committed
Fix tests
1 parent 7b76677 commit aab4891

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

pytest_reportportal/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def __init__(self, pytest_config: Config) -> None:
7474
"""Initialize required attributes."""
7575
self.rp_rerun = (pytest_config.option.rp_rerun or pytest_config.getini('rp_rerun'))
7676
self.rp_endpoint = self.find_option(pytest_config, 'rp_endpoint')
77-
self.rp_hierarchy_code = self.find_option(pytest_config, 'rp_hierarchy_code')
77+
self.rp_hierarchy_code = to_bool(self.find_option(pytest_config, 'rp_hierarchy_code'))
7878
self.rp_dir_level = int(self.find_option(pytest_config, 'rp_hierarchy_dirs_level'))
79-
self.rp_hierarchy_dirs = self.find_option(pytest_config, 'rp_hierarchy_dirs')
80-
self.rp_hierarchy_test_file = self.find_option(pytest_config, 'rp_hierarchy_test_file')
79+
self.rp_hierarchy_dirs = to_bool(self.find_option(pytest_config, 'rp_hierarchy_dirs'))
8180
self.rp_dir_path_separator = self.find_option(pytest_config, 'rp_hierarchy_dir_path_separator')
81+
self.rp_hierarchy_test_file = to_bool(self.find_option(pytest_config, 'rp_hierarchy_test_file'))
8282
self.rp_ignore_attributes = set(self.find_option(pytest_config, 'rp_ignore_attributes') or [])
8383
self.rp_is_skipped_an_issue = self.find_option(pytest_config, 'rp_is_skipped_an_issue')
8484
self.rp_issue_id_marks = self.find_option(pytest_config, 'rp_issue_id_marks')

pytest_reportportal/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def add_shared_option(name, help_str, default=None, action='store'):
512512
'rp_hierarchy_test_file',
513513
default=True,
514514
type='bool',
515-
help='Show file name in hierarchy. Depends on rp_hierarchy_dirs_level to get deep enough')
515+
help='Show file name in hierarchy')
516516
parser.addini(
517517
'rp_issue_system_url',
518518
default='',

tests/unit/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def getoption_side_effect(name, default=None):
7171
mocked_config.option.rp_launch_uuid_print_output = 'STDOUT'
7272
mocked_config.option.rp_client_type = 'SYNC'
7373
mocked_config.option.rp_report_fixtures = 'False'
74+
mocked_config.option.rp_hierarchy_code = 'False'
75+
mocked_config.option.rp_hierarchy_dirs = 'False'
76+
mocked_config.option.rp_hierarchy_test_file = 'True'
77+
mocked_config.option.rp_skip_connection_test = 'False'
7478
return mocked_config
7579

7680

tests/unit/test_plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def test_logger_handle_attachment(mock_handler, logger, log_level):
5555
log_call("Some {} message".format(log_level), attachment=attachment)
5656
expect(mock_handler.call_count == 1,
5757
'logger.handle called more than 1 time')
58-
expect(getattr(mock_handler.call_args[0][0], "attachment") == attachment,
59-
'record.attachment in args doesn\'t match real value')
58+
expect(getattr(mock_handler.call_args[0][0], 'attachment') == attachment,
59+
"record.attachment in args doesn't match real value")
6060
assert_expectations()
6161

6262

@@ -327,6 +327,7 @@ def test_pytest_sessionfinish(mocked_session):
327327

328328
def test_pytest_addoption_adds_correct_ini_file_arguments():
329329
"""Test the correct list of options are available in the .ini file."""
330+
mock_parser = mock.MagicMock(spec=Parser)
330331
expected_argument_names = (
331332
'rp_launch',
332333
'rp_launch_id',
@@ -353,8 +354,8 @@ def test_pytest_addoption_adds_correct_ini_file_arguments():
353354
'rp_hierarchy_code',
354355
'rp_hierarchy_dirs_level',
355356
'rp_hierarchy_dirs',
356-
'rp_display_suite_test_file',
357357
'rp_hierarchy_dir_path_separator',
358+
'rp_hierarchy_test_file',
358359
'rp_issue_system_url',
359360
'rp_bts_issue_url',
360361
'rp_bts_project',
@@ -370,7 +371,6 @@ def test_pytest_addoption_adds_correct_ini_file_arguments():
370371
'rp_read_timeout',
371372
'rp_report_fixtures'
372373
)
373-
mock_parser = mock.MagicMock(spec=Parser)
374374

375375
pytest_addoption(mock_parser)
376376

0 commit comments

Comments
 (0)