Skip to content

Commit ffa706f

Browse files
pcaspersjenkins
authored andcommitted
QPR-12276 do not require equal optional cols
1 parent 5f106ac commit ffa706f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Tools/PythonTools/compare_files.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,23 @@ def compare_files_df(name, file_1, file_2, config):
401401
optional_cols = copy.deepcopy(config['optional_cols'])
402402
logger.debug('Optional columns found: %s', str (optional_cols))
403403

404-
# Check that each optional col either exists in both DataFrames, or is missing in both. Otherwise, we fail the test.
404+
# Check that each optional col either exists in both DataFrames, or is missing in both. Otherwise, we fail the test
405+
# if require_equal_optional_cols is true (or not given)
405406
missing_ocols = []
406407
for col in optional_cols:
407408
if (col in df_1.columns and col not in df_2.columns) or (col not in df_1.columns and col in df_2.columns):
408409
missing_ocols.append(col)
409410
if missing_ocols:
410411
logger.warning('The columns, %s, are in one Dataframe but not the other.', str(missing_ocols))
411-
return False
412+
if 'require_equal_optional_cols' in config:
413+
if config['require_equal_optional_cols']:
414+
logger.warning('Failing test, because require_equal_optional_cols is true')
415+
return False
416+
else:
417+
logger.warning('Ignore unequal optional cols, because because require_equal_optional_cols is false')
418+
else:
419+
logger.warning('Failing test, because require_equal_optional_cols is not given, defaults to true')
420+
return False
412421

413422
# For each optional col, check whether it is found in each DataFrame. If so, add it.
414423
for col in optional_cols:

Tools/PythonTools/comparison_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@
921921
"ShiftSize_1",
922922
"ShiftSize_2"
923923
],
924+
"require_equal_optional_cols": false,
924925
"column_settings": [
925926
{
926927
"names": [

0 commit comments

Comments
 (0)