import subprocess
command = 'python deselect_tests.py deselected_tests.yaml'
proc = subprocess.run(command.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
deselected_tests = proc.stdout[:-1]

common_set_of_daal_failures = {
    '.*test_dtype_match.*',
    '.*test_nonuniform_strategies.*', # https://github.com/IntelPython/daal4py/issues/69
    '.*test_imports_strategies.*',
    '.*test_predict_proba_multilabel.*', # FIXME: test is not skipped
    }

lin_failures = common_set_of_daal_failures.copy()
lin_failures.update({
    '.*test_not_symmetric_metric.*', # SAT-3885
    '.*test_binary_sample_weight_invariance.*',  # SAT-3885
    '.*test_oob_score_regressors.*', # Muted by Rybkin, Alexander with comment:
                                     # Expected to be failed due to unreasonable tight tests.
})

mac_failures = common_set_of_daal_failures.copy()
mac_failures.update({
    'test_sparse_classification',  # SAT-1591
    '.*test_partial_dependence_dataframe.*', #
    '.*test_not_symmetric_metric.*', # SAT-3885
    '.*test_binary_sample_weight_invariance.*',  # SAT-3885
    '.*test_oob_score_regressors.*', # Muted by Rybkin, Alexander with comment:
                                     # Expected to be failed due to unreasonable tight tests.
})

win_failures = common_set_of_daal_failures.copy()
win_failures.update({
    '.*test_not_symmetric_metric.*', # SAT-3885
    '.*test_binary_sample_weight_invariance.*',  # SAT-3885
    '.*test_check_n_features_in_after_fitting.*', # SAT-3885
    '.*test_pca_svd_solver_auto.*', # SAT-3885
    '.*test_whitening.*', # SAT-3885
    '.*test_check_estimator.*', # SAT-3885
    '.*test_svc.*', # SAT-3885
})

CONFIG = {
    'framework' : 'other',
    'arg' : 'pytest --disable-warnings -m "not network" ' + deselected_tests + ' --pyargs sklearn',
    'env' : [ {'USE_SKLEARNEX': '1'} ],
    'expect_except' : None,
    'need_sources' : False,
    'location' : None,
    'use_re' : True,
    'parser' : 'pytest',
    'errors' : {
        '2.7' : {
            'Win' : set(),
            'Lin' : set(),
            'Mac' : set()
        },
        '3.5' : {
            'Win' : set(),
            'Lin' : set(),
            'Mac' : set()
        },
    },
    'failures' : {
        '2.7' : {
            'Win' : win_failures,
            'Lin' : lin_failures,
            'Mac' : mac_failures
        },
        '3.5' : {
            'Win' : win_failures,
            'Lin' : lin_failures,
            'Mac' : mac_failures
        },
        '3.6' : {
            'Win' : win_failures,
            'Lin' : lin_failures,
            'Mac' : mac_failures
        },
        '3.7' : {
            'Win' : win_failures,
            'Lin' : lin_failures,
            'Mac' : mac_failures
        },
    },
    'validation' : {
        'failures' : {
            '2.7' : {
                'Win' : {
                    'test_standard_scaler_numerical_stability',#SAT-1662
                },
                'Lin' : set(),
                'Mac' : set(),
            },
        },
    },
}

def fetch_config(pyver):
    return CONFIG
