fix: original sort order (#768)

This commit is contained in:
Jim Brännlund 2023-11-07 15:19:54 +01:00 committed by GitHub
parent e48a649247
commit 4ee12c42cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 1 deletions

View File

@ -6,6 +6,13 @@ Versions follow `Semantic Versioning`_ (``<major>.<minor>.<patch>``).
Version History Version History
--------------- ---------------
Unreleased
~~~~~~~~~~
* Fix original initial sort INI-setting.
* Thanks to `@sturmf <https://github.com/sturmf>`_ for reporting.
4.1.0 (2023-11-04) 4.1.0 (2023-11-04)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -57,7 +57,7 @@ const renderContent = (tests) => {
// remove all sorting classes and set the relevant // remove all sorting classes and set the relevant
findAll('.sortable', tableHeader).forEach((elem) => elem.classList.remove('asc', 'desc')) findAll('.sortable', tableHeader).forEach((elem) => elem.classList.remove('asc', 'desc'))
tableHeader.querySelector(`.sortable[data-column-type="${sortAttr}"]`).classList.add(sortAsc ? 'desc' : 'asc') tableHeader.querySelector(`.sortable[data-column-type="${sortAttr}"]`)?.classList.add(sortAsc ? 'desc' : 'asc')
newTable.appendChild(tableHeader) newTable.appendChild(tableHeader)
if (!rows.length) { if (!rows.length) {

View File

@ -823,6 +823,52 @@ class TestHTML:
count = log.count(each) count = log.count(each)
assert_that(count).is_equal_to(occurrence) assert_that(count).is_equal_to(occurrence)
@pytest.mark.parametrize(
"sort, order",
[
(None, ["BBB", "AAA", "CCC"]),
("result", ["BBB", "AAA", "CCC"]),
("testId", ["AAA", "BBB", "CCC"]),
("duration", ["CCC", "BBB", "AAA"]),
("original", ["AAA", "BBB", "CCC"]),
],
)
def test_initial_sort(self, pytester, sort, order):
if sort is not None:
pytester.makeini(
f"""
[pytest]
initial_sort = {sort}
"""
)
pytester.makepyfile(
"""
import pytest
from time import sleep
def test_AAA():
sleep(0.3)
assert True
def test_BBB():
sleep(0.2)
assert False
def test_CCC():
sleep(0.1)
assert True
"""
)
page = run(pytester)
assert_results(page, passed=2, failed=1)
result = page.select("td.col-testId")
assert_that(result).is_length(3)
for row, expected in zip(result, order):
assert_that(row.string).contains(expected)
class TestLogCapturing: class TestLogCapturing:
LOG_LINE_REGEX = r"\s+this is {}" LOG_LINE_REGEX = r"\s+this is {}"