Skip to content

Commit

Permalink
TST: remove nested profile calls for 3.12 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
tangkong committed Aug 27, 2024
1 parent edd0383 commit 64a788f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions happi/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# test_cli.py

import cProfile
import functools
import itertools
import logging
import pstats
import re
from collections.abc import Iterable
from typing import Any
Expand Down Expand Up @@ -829,14 +827,11 @@ def test_profile_cli(runner: CliRunner, happi_cfg: str, args: tuple[str]):
print("Resetting the line profiler...")
pcdsutils.profile.reset_profiler()

with cProfile.Profile() as pr:
result = runner.invoke(
happi_cli,
['--path', happi_cfg, 'profile'] + list(args),
)
result = runner.invoke(
happi_cli,
['--path', happi_cfg, 'profile'] + list(args),
)

st = pstats.Stats(pr).strip_dirs().sort_stats("tottime")
st.print_stats(20)
assert_in_expected(
result,
'Profile completed successfully'
Expand Down

0 comments on commit 64a788f

Please sign in to comment.