1 parent
0421994fe6
commit
425ea7449b
138 files changed
+5705
-1012
No files matched your search
@@ -0,0 +1,35 @@
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_query_catalog_dead_code_lint_is_scoped_to_queries_only():
|
||||
queries_mod = (ROOT / "src/queries/mod.rs").read_text()
|
||||
for dialect in ("sqlite", "mysql", "pgsql"):
|
||||
assert f"#[allow(dead_code)]\npub mod {dialect};" in queries_mod
|
||||
assert "#![allow(dead_code)]" not in queries_mod
|
||||
|
||||
rust_sources = [p for p in (ROOT / "src").rglob("*.rs") if p != ROOT / "src/queries/mod.rs"]
|
||||
for path in rust_sources:
|
||||
text = path.read_text()
|
||||
assert "#![allow(warnings)]" not in text, path
|
||||
assert "#![allow(dead_code)]" not in text, path
|
||||
|
||||
|
||||
def test_test_only_session_helpers_are_not_in_production_build():
|
||||
text = (ROOT / "src/auth/session.rs").read_text()
|
||||
signatures = [
|
||||
"pub fn new(timeout: Duration) -> Self",
|
||||
"pub fn new_with_tls_verify(timeout: Duration, tls_verify_override: Option<bool>) -> Self",
|
||||
"pub fn add_account_to_browser(",
|
||||
]
|
||||
for signature in signatures:
|
||||
pos = text.index(signature)
|
||||
prefix = text[max(0, pos - 120):pos]
|
||||
assert "#[cfg(test)]" in prefix, signature
|
||||
|
||||
|
||||
def test_test_only_rfc822_helper_is_not_in_production_build():
|
||||
text = (ROOT / "src/smtp/builder.rs").read_text()
|
||||
pos = text.index("pub fn build_rfc822(")
|
||||
assert "#[cfg(test)]" in text[max(0, pos - 80):pos]
|
||||
Reference in new issue
Block a user