예제 #1
0
파일: views.py 프로젝트: byungwoo733/squad
def test_run(request, group_slug, project_slug, build_version, job_id):
    group = Group.objects.get(slug=group_slug)
    project = group.projects.get(slug=project_slug)
    build = get_object_or_404(project.builds, version=build_version)
    test_run = get_object_or_404(build.test_runs, job_id=job_id)

    status = test_run.status.by_suite().prefetch_related('suite', 'suite__metadata').all()

    tests_status = [s for s in status if s.has_tests]
    metrics_status = [s for s in status if s.has_metrics]

    attachments = [
        (f['filename'], file_type(f['filename']), f['length'])
        for f in test_run.attachments.values('filename', 'length')
    ]

    context = {
        'project': project,
        'build': build,
        'test_run': test_run,
        'metadata': sorted(test_run.metadata.items()),
        'attachments': attachments,
        'tests_status': tests_status,
        'metrics_status': metrics_status,
    }
    return render(request, 'squad/test_run.html', context)
예제 #2
0
파일: views.py 프로젝트: Linaro/squad
def test_run(request, group_slug, project_slug, build_version, job_id):
    project = request.project
    build = get_build(project, build_version)
    test_run = get_object_or_404(build.test_runs, job_id=job_id)

    status = test_run.status.by_suite().prefetch_related('suite', 'suite__metadata').all()

    tests_status = [s for s in status if s.has_tests]
    metrics_status = [s for s in status if s.has_metrics]

    attachments = [
        (f['filename'], file_type(f['filename']), f['length'])
        for f in test_run.attachments.values('filename', 'length')
    ]

    context = {
        'project': project,
        'build': build,
        'test_run': test_run,
        'metadata': sorted(test_run.metadata.items()),
        'attachments': attachments,
        'tests_status': tests_status,
        'metrics_status': metrics_status,
    }
    return render(request, 'squad/test_run.jinja2', context)
예제 #3
0
파일: views.py 프로젝트: chaws/squad
def test_run_suite_test_details(request, group_slug, project_slug,
                                build_version, testrun, suite_slug, test_name):
    context = __test_run_suite_context__(request, group_slug, project_slug,
                                         build_version, testrun, suite_slug)
    test_name = test_name.replace("$", "/")
    suite_slug = suite_slug.replace("$", "/")
    metadata = get_object_or_404(SuiteMetadata,
                                 kind='test',
                                 suite=suite_slug,
                                 name=test_name)
    tests = Test.objects.filter(suite=context['suite'],
                                metadata=metadata,
                                build=context['build'],
                                environment=context['test_run'].environment)
    if len(tests) == 0:
        raise Http404()

    # There's more then one test that meets the criteria, this usually
    # means resubmitted job.
    if len(tests) > 1:
        # Calculate the most common status and confidence score.
        status, confidence_score = test_confidence(tests.first())
        # Take the first test with the most common status as the relevant
        # one.
        for t in tests:
            if t.status == status:
                test = t
        if not test:
            # Something went wrong, we're supposed to find a test by now.
            raise Http404()
        else:
            test.confidence_score = confidence_score
    else:
        test = tests.first()

    attachments = [
        (f['filename'], file_type(f['filename']), f['length'])
        for f in context['test_run'].attachments.values('filename', 'length')
    ]

    context.update({'test': test, 'attachments': attachments})
    return render(request, 'squad/test_run_suite_test_details.jinja2', context)
예제 #4
0
def test_run_suite_test_details(request, group_slug, project_slug,
                                build_version, testrun, suite_slug, test_name):
    context = __test_run_suite_context__(request, group_slug, project_slug,
                                         build_version, testrun, suite_slug)
    test_name = test_name.replace("$", "/")
    suite_slug = suite_slug.replace("$", "/")
    metadata = get_object_or_404(SuiteMetadata,
                                 kind='test',
                                 suite=suite_slug,
                                 name=test_name)
    test = get_object_or_404(context['test_run'].tests,
                             suite=context['suite'],
                             metadata=metadata)
    attachments = [
        (f['filename'], file_type(f['filename']), f['length'])
        for f in context['test_run'].attachments.values('filename', 'length')
    ]

    context.update({'test': test, 'attachments': attachments})
    return render(request, 'squad/test_run_suite_test_details.jinja2', context)
예제 #5
0
파일: test_utils.py 프로젝트: Linaro/squad
 def test_text(self):
     self.assertEqual('text', file_type('foo.txt'))
예제 #6
0
파일: test_utils.py 프로젝트: Linaro/squad
 def test_image(self):
     self.assertEqual('image', file_type('foo.png'))
     self.assertEqual('image', file_type('foo.jpg'))
예제 #7
0
파일: test_utils.py 프로젝트: Linaro/squad
 def test_code(self):
     self.assertEqual('code', file_type('foo.py'))
     self.assertEqual('code', file_type('foo.sh'))
예제 #8
0
 def test_text(self):
     self.assertEqual('text', file_type('foo.txt'))
예제 #9
0
 def test_image(self):
     self.assertEqual('image', file_type('foo.png'))
     self.assertEqual('image', file_type('foo.jpg'))
예제 #10
0
 def test_code(self):
     self.assertEqual('code', file_type('foo.py'))
     self.assertEqual('code', file_type('foo.sh'))