From d11c4aebe986bca7d113683f557c0ac2565d68f3 Mon Sep 17 00:00:00 2001 From: tangkong Date: Mon, 26 Aug 2024 17:48:57 -0700 Subject: [PATCH 1/4] TST: properly mark test_multi_backend as needing pymongo --- happi/tests/test_backends.py | 1 + 1 file changed, 1 insertion(+) diff --git a/happi/tests/test_backends.py b/happi/tests/test_backends.py index 67a34261..e9bd8d17 100644 --- a/happi/tests/test_backends.py +++ b/happi/tests/test_backends.py @@ -268,6 +268,7 @@ def test_beckoff_axis_device_class(mockqsbackend): assert sam_x.__class__.__name__ == 'IMS' +@requires_mongo def test_multi_backend(mockmulti, item_info, valve_info): mm = mockmulti assert len(mm.all_items) == 3 From febdfffa4e8c90a8e9abdbef678eb5a3bd891b13 Mon Sep 17 00:00:00 2001 From: tangkong Date: Mon, 26 Aug 2024 17:57:30 -0700 Subject: [PATCH 2/4] TST: add mongomock to conda test deps --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index e572aabf..a9cf7503 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -44,6 +44,7 @@ test: - pytest - ipython - line_profiler + - mongomock - pcdsutils - pcdsdevices From edd03835036f04837b53c741cd03754960f7eb28 Mon Sep 17 00:00:00 2001 From: tangkong Date: Tue, 27 Aug 2024 08:27:05 -0700 Subject: [PATCH 3/4] BLD: add pymongo to conda test deps --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index a9cf7503..5003b8ca 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -47,6 +47,7 @@ test: - mongomock - pcdsutils - pcdsdevices + - pymongo about: dev_url: https://github.com/pcdshub/happi/ From 64a788f5607e5112b8e6c5841f0221c078eae439 Mon Sep 17 00:00:00 2001 From: tangkong Date: Tue, 27 Aug 2024 09:38:35 -0700 Subject: [PATCH 4/4] TST: remove nested profile calls for 3.12 compat --- happi/tests/test_cli.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/happi/tests/test_cli.py b/happi/tests/test_cli.py index 1f72946d..d39e8cb5 100644 --- a/happi/tests/test_cli.py +++ b/happi/tests/test_cli.py @@ -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 @@ -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'