Visitar URL original
test: fix two tests that failed on the Rocky 8 old_sqlite job · coveragepy/coveragepy@8273f72 · GitHub
Skip to content

Commit 8273f72

Browse files
committed
test: fix two tests that failed on the Rocky 8 old_sqlite job
1 parent ce216fd commit 8273f72

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎coverage/sqldata.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,6 @@ def sys_info(cls) -> list[tuple[str, Any]]:
12211221
temp_store = [row[0] for row in cur]
12221222
with db.execute("PRAGMA compile_options") as cur:
12231223
copts = [row[0] for row in cur]
1224-
copts = textwrap.wrap(", ".join(copts), width=75)
12251224

12261225
return [
12271226
("sqlite3_sqlite_version", sqlite3.sqlite_version),

‎tests/test_cmdline.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
from __future__ import annotations
77

88
import ast
9+
import contextlib
910
import os
1011
import pprint
1112
import re
13+
import sqlite3
1214
import sys
1315
import textwrap
1416
from collections.abc import Mapping
@@ -486,9 +488,13 @@ def test_debug_sqlite(self) -> None:
486488
out = self.stdout()
487489
assert "sqlite3_sqlite_version:" in out
488490
assert "sqlite3_compile_options:" in out
489-
assert len(out.splitlines()) > 15
490-
# Lots of lines of indented SQLite compile-time options.
491-
assert len(re_lines(r"^ {20,35}[A-Z]{3}", out)) > 12
491+
with contextlib.closing(sqlite3.connect(":memory:")) as con:
492+
copts = [row[0] for row in con.execute("pragma compile_options")]
493+
assert copts
494+
for copt in copts:
495+
assert f"{copt}\n" in out
496+
# The options are on indented lines.
497+
assert re_lines(r"^ {20,35}[A-Z]{3}", out)
492498

493499
def test_erase(self) -> None:
494500
# coverage erase

‎tests/test_data.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,10 @@ def test_combining_from_files(self) -> None:
11261126
self.assert_exists("cov2/.coverage.xxx")
11271127

11281128
@pytest.mark.skipif(env.WINDOWS, reason="Windows lets us delete files in read-only directories")
1129+
@pytest.mark.skipif(
1130+
not env.WINDOWS and os.geteuid() == 0,
1131+
reason="root can delete files in read-only directories",
1132+
)
11291133
def test_hostile_journal_matches_sqlite(self) -> None:
11301134
# hostile_journal() builds its bytes by hand. Check them against a
11311135
# journal SQLite writes itself. A commit spanning two databases names

0 commit comments

Comments
 (0)