{% extends "genalyzer/base.html" %} {% block script %} // Lazy plot loading functionality document.addEventListener('DOMContentLoaded', function() { // Track which plots have been loaded var loadedPlots = new Set(); var plotlyLoaded = false; // Function to load Plotly if not already loaded function ensurePlotlyLoaded(callback) { if (typeof Plotly !== 'undefined') { plotlyLoaded = true; callback(); return; } if (plotlyLoaded) { // Already loading, wait for it setTimeout(function() { ensurePlotlyLoaded(callback); }, 100); return; } console.log('Loading Plotly.js...'); plotlyLoaded = true; // Mark as loading var script = document.createElement('script'); script.src = 'https://cdn.plot.ly/plotly-3.1.0.min.js'; script.onload = function() { console.log('Plotly.js loaded successfully'); callback(); }; script.onerror = function() { console.error('Failed to load Plotly.js'); plotlyLoaded = false; }; document.head.appendChild(script); } // Function to load a single plot function loadPlot(plotElement) { var plotId = plotElement.getAttribute('data-plot-id'); if (loadedPlots.has(plotId)) return; console.log('Loading plot:', plotId); function renderPlot() { var plotData; {% if self_contained %} // For self-contained reports, read from embedded script tags var dataScript = document.getElementById('plot-data-' + plotId); if (dataScript) { try { plotData = JSON.parse(dataScript.textContent); console.log('Parsed plot data for', plotId, plotData); } catch (e) { console.error('Error parsing plot data for', plotId, e); plotElement.innerHTML = '

Error parsing plot data

'; return; } } {% else %} // For split reports, fetch from separate JSON files fetch('plots/' + plotId + '.json') .then(response => response.json()) .then(data => { plotData = data; actualRender(); }) .catch(error => { console.error('Error loading plot data:', error); plotElement.innerHTML = '

Error loading plot data

'; }); return; // Exit early for async loading {% endif %} function actualRender() { if (plotData && typeof Plotly !== 'undefined') { console.log('Rendering plot', plotId, 'with data:', plotData); Plotly.newPlot(plotElement, plotData.data, plotData.layout, {responsive: true}) .then(function() { console.log('Plot', plotId, 'rendered successfully'); loadedPlots.add(plotId); }) .catch(function(error) { console.error('Error rendering plot', plotId, error); plotElement.innerHTML = '

Error rendering plot

'; }); } else { console.error('Missing plotData or Plotly for', plotId); plotElement.innerHTML = '

Plotly not available

'; } } actualRender(); } ensurePlotlyLoaded(renderPlot); } // Function to check if plots section is expanded and load plots function checkAndLoadPlots(detailsElement) { if (detailsElement.open) { console.log('Loading plots for expanded section'); var plots = detailsElement.querySelectorAll('.plot[data-plot-id]'); plots.forEach(loadPlot); } } // Listen for plot section expansions document.addEventListener('toggle', function(event) { if (event.target.classList.contains('plots')) { checkAndLoadPlots(event.target); } }, true); // Load plots that are already expanded on page load var expandedPlotSections = document.querySelectorAll('details.plots[open]'); expandedPlotSections.forEach(checkAndLoadPlots); }); {% endblock %} {% block content %}

Summary

{% block summary %}
{% set tests_by_category = tests|groupby('status.category') %} {% set nodes_run = tests|map(attribute='item.nodeid')|list %} {% set nof_nodes_not_run = session.items|rejectattr('nodeid', 'in', nodes_run)|list|count %} {% set ns = namespace(sum=0.0) %} {% set total = tests|count %} {% set r = 16 %} {% set spacing = 0.4 %} {% set C = 2 * 3.141592653589793 * r %} {% for category, sub_tests in tests_by_category %} {% set count = sub_tests|count %} {% set L = count / (total + nof_nodes_not_run) * C %} {% set color = colors[category] %} {% set ns.sum = ns.sum + L %} {% endfor %} {{ total }}
{% for category, tests in tests_by_category %} {{ tests|count }} {{ category }} {% endfor %} {% if nof_nodes_not_run %} {{ nof_nodes_not_run }} not run {% endif %}
{% endblock %}
{% if warnings %}
{% block warnings %}

Warnings

Warnings {{ warnings|count }}

    {% for warning in warnings %}
  • {{ warning.category.__name__ }} {{ warning.message }}
    {{ warning.filename }}:{{ warning.lineno }}
  • {% endfor %}
{% endblock %}
{% endif %}

Tests

{% for fspath, tests in tests|groupby('item.fspath') %} {% set first_item = tests|map(attribute='item')|first %}

{% block module_title scoped %} {% block module_name scoped %} {{ first_item.nodeid.split('::')|first }} {% endblock %} {% for category, tests in tests|groupby('status.category') -%} {{ tests|count }} {%- endfor %} {{ tests|map(attribute='phases')|map('sum', 'report.duration')|sum|timedelta }} {% endblock %}

{% include "genalyzer/module.html" %}
{% endfor %}
{% endblock %}