From 252e7ea6c9ceb350d9420bbba3735a100846b4e6 Mon Sep 17 00:00:00 2001 From: ANIR1604 Date: Tue, 31 Mar 2026 01:39:14 +0530 Subject: [PATCH 1/2] feat(regression): add never_worked state for tests with no pass history Surfaces tests that have never passed on any platform via a new never_worked property on RegressionTest, a Platform History column on the regression index and by-sample views, and per-platform history detail on the test view page. --- mod_regression/models.py | 10 +++++ templates/regression/by_sample.html | 13 ++++++ templates/regression/index.html | 13 ++++++ templates/regression/test_view.html | 17 ++++++++ tests/test_regression/test_controllers.py | 52 +++++++++++++++++++++++ 5 files changed, 105 insertions(+) diff --git a/mod_regression/models.py b/mod_regression/models.py index 9ade0a61..7d11b472 100644 --- a/mod_regression/models.py +++ b/mod_regression/models.py @@ -137,6 +137,16 @@ def __repr__(self) -> str: """ return f"" + @property + def never_worked(self) -> bool: + """ + Determine if this regression test has never passed on any platform. + + :return: True if the test has no pass history on either platform + :rtype: bool + """ + return self.last_passed_on_linux is None and self.last_passed_on_windows is None + class RegressionTestOutput(Base): """Model to store output of regression test.""" diff --git a/templates/regression/by_sample.html b/templates/regression/by_sample.html index 994120e3..3d279682 100644 --- a/templates/regression/by_sample.html +++ b/templates/regression/by_sample.html @@ -13,6 +13,7 @@

Regression tests for sample {{ sample.id }}

ID Command + Platform History Actions @@ -21,6 +22,18 @@

Regression tests for sample {{ sample.id }}

{{ test.id }} {{ test.command }} + + {% if test.never_worked %} + Never Worked + {% else %} + {% if test.last_passed_on_linux %} + #{{ test.last_passed_on_linux }}  + {% endif %} + {% if test.last_passed_on_windows %} + #{{ test.last_passed_on_windows }} + {% endif %} + {% endif %} +   {% if user is not none and user.has_role('contributor') %} diff --git a/templates/regression/index.html b/templates/regression/index.html index 3e98f1fb..83393453 100644 --- a/templates/regression/index.html +++ b/templates/regression/index.html @@ -63,6 +63,7 @@

Regression tests

ID Command Active + Platform History Actions Tags @@ -76,6 +77,18 @@

Regression tests

{{ test.id }} {{ test.command }} {{ test.active }} + + {% if test.never_worked %} + Never Worked + {% else %} + {% if test.last_passed_on_linux %} + #{{ test.last_passed_on_linux }}  + {% endif %} + {% if test.last_passed_on_windows %} + #{{ test.last_passed_on_windows }} + {% endif %} + {% endif %} +   {% if user is not none and user.has_role('contributor') %} diff --git a/templates/regression/test_view.html b/templates/regression/test_view.html index 95f79dec..43735633 100644 --- a/templates/regression/test_view.html +++ b/templates/regression/test_view.html @@ -12,6 +12,23 @@

Regression test {{ test.id }}

Input type: {{ test.input_type.description }}

Output type: {{ test.output_type.description }}

Description: {{ test.description or "No description" }}

+

Platform history:

+

{% set sample = test.sample %} Tags of sample: diff --git a/tests/test_regression/test_controllers.py b/tests/test_regression/test_controllers.py index b7edab9f..c83cddd2 100644 --- a/tests/test_regression/test_controllers.py +++ b/tests/test_regression/test_controllers.py @@ -575,3 +575,55 @@ def test_category_description_shown_without_tags(self): self.assertIn('data-category="1"', str(response.data)) # The JavaScript should ensure the description is visible, but we can't test JS execution in unit tests # This test verifies the HTML structure is correct for the fix to work + + def test_never_worked_when_both_platforms_null(self): + """Check never_worked is True when neither platform has a passing run.""" + regression_test = RegressionTest.query.filter(RegressionTest.id == 1).first() + self.assertIsNone(regression_test.last_passed_on_linux) + self.assertIsNone(regression_test.last_passed_on_windows) + self.assertTrue(regression_test.never_worked) + + def test_never_worked_false_when_linux_has_passed(self): + """Check never_worked is False when Linux has a recorded pass.""" + regression_test = RegressionTest.query.filter(RegressionTest.id == 1).first() + regression_test.last_passed_on_linux = 1 + g.db.commit() + self.assertFalse(regression_test.never_worked) + + def test_never_worked_false_when_windows_has_passed(self): + """Check never_worked is False when Windows has a recorded pass.""" + regression_test = RegressionTest.query.filter(RegressionTest.id == 1).first() + regression_test.last_passed_on_windows = 1 + g.db.commit() + self.assertFalse(regression_test.never_worked) + + def test_never_worked_false_when_both_platforms_have_passed(self): + """Check never_worked is False when both platforms have a recorded pass.""" + regression_test = RegressionTest.query.filter(RegressionTest.id == 1).first() + regression_test.last_passed_on_linux = 1 + regression_test.last_passed_on_windows = 2 + g.db.commit() + self.assertFalse(regression_test.never_worked) + + def test_regression_index_shows_never_worked_badge(self): + """Check the index page renders the Never Worked label for tests with no pass history.""" + response = self.app.test_client().get('/regression/') + self.assertEqual(response.status_code, 200) + self.assertIn(b'Never Worked', response.data) + + def test_regression_view_shows_platform_history_section(self): + """Check the test detail page renders the platform history section.""" + response = self.app.test_client().get('/regression/test/1/view') + self.assertEqual(response.status_code, 200) + self.assertIn(b'Platform history', response.data) + self.assertIn(b'Never passed', response.data) + + def test_regression_view_shows_last_passed_link_when_set(self): + """Check the test detail page links to the last passing test run when history exists.""" + regression_test = RegressionTest.query.filter(RegressionTest.id == 1).first() + regression_test.last_passed_on_linux = 1 + g.db.commit() + response = self.app.test_client().get('/regression/test/1/view') + self.assertEqual(response.status_code, 200) + self.assertIn(b'Test #1', response.data) + self.assertNotIn(b'Never Worked', response.data) From 0f08c6a8483f67afb375e9dffdcfef74315a852e Mon Sep 17 00:00:00 2001 From: ANIR1604 Date: Tue, 31 Mar 2026 01:49:07 +0530 Subject: [PATCH 2/2] Minor Changes --- templates/macros.html | 13 +++++++++++++ templates/regression/by_sample.html | 14 ++------------ templates/regression/index.html | 14 ++------------ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/templates/macros.html b/templates/macros.html index 424c619b..72a393d7 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -21,6 +21,19 @@ {% endif %} {% endmacro %} +{% macro platform_history_cell(test) %} + {% if test.never_worked %} + Never Worked + {% else %} + {% if test.last_passed_on_linux %} + #{{ test.last_passed_on_linux }}  + {% endif %} + {% if test.last_passed_on_windows %} + #{{ test.last_passed_on_windows }} + {% endif %} + {% endif %} +{% endmacro %} + {% macro render_media_info(info) %}