<s> from datetime import datetime <EOL> from changes . constants import Result , Status <EOL> from changes . testutils import TestCase <EOL> from changes . utils . originfinder import find_failure_origins <EOL> class FindFailureOriginsTest ( TestCase ) : <EOL> def test_simple ( self ) : <EOL> project = self . create_project ( ) <EOL> source = self . create_source ( project ) <EOL> build_a = self . create_build ( <EOL> project = project , result = Result . passed , status = Status . finished , <EOL> label = '<STR_LIT>' , date_created = datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:15> , <NUM_LIT> ) , <EOL> source = source ) <EOL> job_a = self . create_job ( build = build_a ) <EOL> build_b = self . create_build ( <EOL> project = project , result = Result . failed , status = Status . finished , <EOL> label = '<STR_LIT>' , date_created = datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:15> , <NUM_LIT> ) , <EOL> source = source ) <EOL> job_b = self . create_job ( build = build_b ) <EOL> build_c = self . create_build ( <EOL> project = project , result = Result . failed , status = Status . finished , <EOL> label = '<STR_LIT>' , date_created = datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:15> , <NUM_LIT> ) , <EOL> source = source ) <EOL> job_c = self . create_job ( build = build_c ) <EOL> build_d = self . create_build ( <EOL> project = project , result = Result . failed , status = Status . finished , <EOL> label = '<STR_LIT>' , date_created = datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:15> , <NUM_LIT> ) , <EOL> source = source ) <EOL> job_d = self . create_job ( build = build_d ) <EOL> self . create_test ( job_a , name = '<STR_LIT:foo>' , result = Result . passed ) <EOL> self . create_test ( job_a , name = '<STR_LIT:bar>' , result = Result . passed ) <EOL> self . create_test ( job_b , name = '<STR_LIT:foo>' , result = Result . failed ) <EOL> self . create_test ( job_b , name = '<STR_LIT:bar>' , result = Result . passed ) <EOL> self . create_test ( job_c , name = '<STR_LIT:foo>' , result = Result . failed ) <EOL> self . create_test ( job_c , name = '<STR_LIT:bar>' , result = Result . failed ) <EOL> foo_d = self . create_test ( job_d , name = '<STR_LIT:foo>' , result = Result . failed ) <EOL> bar_d = self . create_test ( job_d , name = '<STR_LIT:bar>' , result = Result . failed ) <EOL> result = find_failure_origins ( build_d , [ foo_d , bar_d ] ) <EOL> assert result == { <EOL> foo_d : build_b , <EOL> bar_d : build_c <EOL> } </s>
