Merge commit '03943a0e51413f1f7fbd1f9ff852fe7259c0658e' into checkpoint/main_from_release_1.8.2_03943a0e51413f1f7fbd1f9ff852fe7259c0658e

This commit is contained in:
Amine Khaldi 2023-06-27 20:18:36 +01:00
commit 7e50f5e0b0
No known key found for this signature in database
GPG Key ID: B1C074FFC904E2D9
4 changed files with 14 additions and 17 deletions

View File

@ -29,13 +29,13 @@ NUM_PEERS = 5
@contextmanager
def enable_profiler(profile: bool, name: str) -> Iterator[None]:
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required, running with: {sys.version}")
if not profile:
yield
return
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required when profiling is requested, running with: {sys.version}")
with cProfile.Profile() as pr:
yield

View File

@ -18,13 +18,13 @@ with_profile = False
@contextmanager
def enable_profiler(name: str) -> Iterator[None]:
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required, running with: {sys.version}")
if not with_profile:
yield
return
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required when profiling is requested, running with: {sys.version}")
with cProfile.Profile() as pr:
yield

View File

@ -23,13 +23,13 @@ from tools.test_constants import test_constants
@contextmanager
def enable_profiler(profile: bool, counter: int) -> Iterator[None]:
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required, running with: {sys.version}")
if not profile:
yield
return
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required when profiling is requested, running with: {sys.version}")
with cProfile.Profile() as pr:
yield

View File

@ -46,13 +46,13 @@ class ExitOnError(logging.Handler):
@contextmanager
def enable_profiler(profile: bool, counter: int) -> Iterator[None]:
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required, running with: {sys.version}")
if not profile:
yield
return
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required when profiling is requested, running with: {sys.version}")
with cProfile.Profile() as pr:
receive_start_time = time.monotonic()
yield
@ -112,9 +112,6 @@ async def run_sync_test(
node_profiler: bool,
start_at_checkpoint: Optional[str],
) -> None:
if sys.version_info < (3, 8):
raise Exception(f"Python 3.8 or higher required, running with: {sys.version}")
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
handler = logging.FileHandler("test-full-sync.log")
@ -129,9 +126,9 @@ async def run_sync_test(
logger.addHandler(check_log)
with tempfile.TemporaryDirectory() as root_dir:
root_path = Path(root_dir)
root_path = Path(root_dir, "root")
if start_at_checkpoint is not None:
shutil.copytree(Path(start_at_checkpoint) / ".", root_path, dirs_exist_ok=True)
shutil.copytree(start_at_checkpoint, root_path)
chia_init(root_path, should_check_keys=False, v1_db=(db_version == 1))
config = load_config(root_path, "config.yaml")