autodetect print/breakpoints (#4581)
* catch stray breakpoints and prints * autodetect debug prints and breakpoints in main code * readd hacky print in pyi_generator?
This commit is contained in:
parent
97fb157b25
commit
53f09756b6
@ -21,7 +21,7 @@ def get_package_size(venv_path: Path, os_name):
|
|||||||
ValueError: when venv does not exist or python version is None.
|
ValueError: when venv does not exist or python version is None.
|
||||||
"""
|
"""
|
||||||
python_version = get_python_version(venv_path, os_name)
|
python_version = get_python_version(venv_path, os_name)
|
||||||
print("Python version:", python_version)
|
print("Python version:", python_version) # noqa: T201
|
||||||
if python_version is None:
|
if python_version is None:
|
||||||
raise ValueError("Error: Failed to determine Python version.")
|
raise ValueError("Error: Failed to determine Python version.")
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
target-version = "py39"
|
target-version = "py39"
|
||||||
output-format = "concise"
|
output-format = "concise"
|
||||||
lint.isort.split-on-trailing-comma = false
|
lint.isort.split-on-trailing-comma = false
|
||||||
lint.select = ["B", "C4", "D", "E", "ERA", "F", "FURB", "I", "PERF", "PTH", "RUF", "SIM", "W"]
|
lint.select = ["B", "C4", "D", "E", "ERA", "F", "FURB", "I", "PERF", "PTH", "RUF", "SIM", "T", "W"]
|
||||||
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF012"]
|
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF012"]
|
||||||
lint.pydocstyle.convention = "google"
|
lint.pydocstyle.convention = "google"
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
"__init__.py" = ["F401"]
|
"__init__.py" = ["F401"]
|
||||||
"tests/*.py" = ["D100", "D103", "D104", "B018", "PERF"]
|
"tests/*.py" = ["D100", "D103", "D104", "B018", "PERF", "T"]
|
||||||
"reflex/.templates/*.py" = ["D100", "D103", "D104"]
|
"reflex/.templates/*.py" = ["D100", "D103", "D104"]
|
||||||
"*.pyi" = ["D301", "D415", "D417", "D418", "E742"]
|
"*.pyi" = ["D301", "D415", "D417", "D418", "E742"]
|
||||||
"*/blank.py" = ["I001"]
|
"*/blank.py" = ["I001"]
|
||||||
|
@ -52,6 +52,7 @@ from reflex.state import (
|
|||||||
StateManagerRedis,
|
StateManagerRedis,
|
||||||
reload_state_module,
|
reload_state_module,
|
||||||
)
|
)
|
||||||
|
from reflex.utils import console
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from selenium import webdriver # pyright: ignore [reportMissingImports]
|
from selenium import webdriver # pyright: ignore [reportMissingImports]
|
||||||
@ -385,7 +386,7 @@ class AppHarness:
|
|||||||
)
|
)
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
print(line) # for pytest diagnosis
|
print(line) # for pytest diagnosis #noqa: T201
|
||||||
m = re.search(reflex.constants.Next.FRONTEND_LISTENING_REGEX, line)
|
m = re.search(reflex.constants.Next.FRONTEND_LISTENING_REGEX, line)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
self.frontend_url = m.group(1)
|
self.frontend_url = m.group(1)
|
||||||
@ -403,11 +404,10 @@ class AppHarness:
|
|||||||
)
|
)
|
||||||
# catch I/O operation on closed file.
|
# catch I/O operation on closed file.
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(e)
|
console.error(str(e))
|
||||||
break
|
break
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
print(line)
|
|
||||||
|
|
||||||
self.frontend_output_thread = threading.Thread(target=consume_frontend_output)
|
self.frontend_output_thread = threading.Thread(target=consume_frontend_output)
|
||||||
self.frontend_output_thread.start()
|
self.frontend_output_thread.start()
|
||||||
|
@ -1202,4 +1202,4 @@ class PyiGenerator:
|
|||||||
or "Var[Template]" in line
|
or "Var[Template]" in line
|
||||||
):
|
):
|
||||||
line = line.rstrip() + " # type: ignore\n"
|
line = line.rstrip() + " # type: ignore\n"
|
||||||
print(line, end="")
|
print(line, end="") # noqa: T201
|
||||||
|
@ -25,7 +25,7 @@ def _pid_exists(pid):
|
|||||||
|
|
||||||
def _wait_for_port(port, server_pid, timeout) -> Tuple[bool, str]:
|
def _wait_for_port(port, server_pid, timeout) -> Tuple[bool, str]:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
print(f"Waiting for up to {timeout} seconds for port {port} to start listening.")
|
print(f"Waiting for up to {timeout} seconds for port {port} to start listening.") # noqa: T201
|
||||||
while True:
|
while True:
|
||||||
if not _pid_exists(server_pid):
|
if not _pid_exists(server_pid):
|
||||||
return False, f"Server PID {server_pid} is not running."
|
return False, f"Server PID {server_pid} is not running."
|
||||||
@ -56,9 +56,9 @@ def main():
|
|||||||
for f in as_completed(futures):
|
for f in as_completed(futures):
|
||||||
ok, msg = f.result()
|
ok, msg = f.result()
|
||||||
if ok:
|
if ok:
|
||||||
print(f"OK: {msg}")
|
print(f"OK: {msg}") # noqa: T201
|
||||||
else:
|
else:
|
||||||
print(f"FAIL: {msg}")
|
print(f"FAIL: {msg}") # noqa: T201
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user