Skip to content

Commit

Permalink
Simplify deprecation warnings when files given
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Jul 4, 2022
1 parent fb18c96 commit d95302b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions python/publish_unit_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ def get_settings(options: dict, gha: Optional[GithubAction] = None) -> Settings:
check_var_condition(test_changes_limit.isnumeric(), f'TEST_CHANGES_LIMIT must be a positive integer or 0: {test_changes_limit}')

# remove when deprecated FILES is removed
if get_var('FILES', options):
default_junit_files_glob = get_var('FILES', options)
if default_junit_files_glob:
gha.warning('Option FILES is deprecated, please use JUNIT_FILES instead!')
# replace with error when deprecated FILES is removed
default_junit_files_glob = None
if not any([get_var(f'{flavour}_FILES', options)
for flavour in ['JUNIT', 'NUNIT', 'XUNIT', 'TRX']]):
elif not any([get_var(f'{flavour}_FILES', options)
for flavour in ['JUNIT', 'NUNIT', 'XUNIT', 'TRX']]):
default_junit_files_glob = '*.xml'
gha.warning(f'At least one of the *_FILES options has to be set! '
f'Falling back to deprecated default "{default_junit_files_glob}"')
Expand Down Expand Up @@ -367,7 +367,7 @@ def get_settings(options: dict, gha: Optional[GithubAction] = None) -> Settings:
json_thousands_separator=get_var('JSON_THOUSANDS_SEPARATOR', options) or punctuation_space,
fail_on_errors=fail_on_errors,
fail_on_failures=fail_on_failures,
junit_files_glob=get_var('JUNIT_FILES', options) or get_var('FILES', options) or default_junit_files_glob,
junit_files_glob=get_var('JUNIT_FILES', options) or default_junit_files_glob,
nunit_files_glob=get_var('NUNIT_FILES', options),
xunit_files_glob=get_var('XUNIT_FILES', options),
trx_files_glob=get_var('TRX_FILES', options),
Expand Down
4 changes: 2 additions & 2 deletions python/test/test_action_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def test_get_settings_junit_files(self):

# this is the deprecated version of JUNIT_FILES
self.do_test_get_settings_no_default_files(JUNIT_FILES='junit-file', FILES='file', expected=self.get_settings_no_default_files(junit_files_glob='junit-file'), warning='Option FILES is deprecated, please use JUNIT_FILES instead!')
self.do_test_get_settings_no_default_files(JUNIT_FILES=None, FILES='file', expected=self.get_settings_no_default_files(junit_files_glob='file'), warning=['Option FILES is deprecated, please use JUNIT_FILES instead!', 'At least one of the *_FILES options has to be set! Falling back to deprecated default "*.xml"'])
self.do_test_get_settings_no_default_files(JUNIT_FILES=None, FILES='file\nfile2', expected=self.get_settings_no_default_files(junit_files_glob='file\nfile2'), warning=['Option FILES is deprecated, please use JUNIT_FILES instead!', 'At least one of the *_FILES options has to be set! Falling back to deprecated default "*.xml"'])
self.do_test_get_settings_no_default_files(JUNIT_FILES=None, FILES='file', expected=self.get_settings_no_default_files(junit_files_glob='file'), warning='Option FILES is deprecated, please use JUNIT_FILES instead!')
self.do_test_get_settings_no_default_files(JUNIT_FILES=None, FILES='file\nfile2', expected=self.get_settings_no_default_files(junit_files_glob='file\nfile2'), warning='Option FILES is deprecated, please use JUNIT_FILES instead!')
self.do_test_get_settings_no_default_files(JUNIT_FILES=None, FILES=None, expected=self.get_settings_no_default_files(junit_files_glob='*.xml'), warning='At least one of the *_FILES options has to be set! Falling back to deprecated default "*.xml"')

def test_get_settings_nunit_files(self):
Expand Down

0 comments on commit d95302b

Please sign in to comment.