ci: Run optimized python and control warnings (#28063)

* ci: run doubly optimized python

* ci: control python warnings
This commit is contained in:
David Arnold 2024-10-09 15:29:30 +02:00 committed by GitHub
parent 9024441ee9
commit bd06784d1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 8 deletions

View file

@ -46,6 +46,9 @@ jobs:
timeout-minutes: 30
env:
NODE_ENV: "production"
PYTHONOPTIMIZE: 2
# noisy 3rd party library warnings
PYTHONWARNINGS: "module,ignore:::babel.messages.extract"
strategy:
fail-fast: false

View file

@ -32,8 +32,6 @@ class ParallelTestRunner:
self.total_tests = 0
self.test_result = None
self.setup_test_file_list()
warnings.simplefilter("module", DeprecationWarning)
warnings.simplefilter("module", PendingDeprecationWarning)
def setup_and_run(self):
self.setup_test_site()

View file

@ -175,15 +175,13 @@ def normalize_query(query: str) -> str:
def record(force=False):
if __debug__:
if frappe.cache.get_value(RECORDER_INTERCEPT_FLAG) or force:
frappe.local._recorder = Recorder(force=force)
if frappe.cache.get_value(RECORDER_INTERCEPT_FLAG) or force:
frappe.local._recorder = Recorder(force=force)
def dump():
if __debug__:
if hasattr(frappe.local, "_recorder"):
frappe.local._recorder.dump()
if hasattr(frappe.local, "_recorder"):
frappe.local._recorder.dump()
class Recorder:

View file

@ -10,6 +10,8 @@ from urllib.parse import parse_qs, urlparse
import cssutils
import pdfkit
pdfkit.source.unicode = str # NOTE: upstream bug; PYTHONOPTIMIZE=1 optimized this away
from bs4 import BeautifulSoup
from packaging.version import Version
from pypdf import PdfReader, PdfWriter