From 0c7c2cf56d55985f3efa25f66faa34706fd9c9e3 Mon Sep 17 00:00:00 2001 From: Jasha <8935917+Jasha10@users.noreply.github.com> Date: Thu, 29 Feb 2024 03:43:46 +0000 Subject: [PATCH] remove dep on pytest-lazy-fixture Due to https://github.com/TvoroG/pytest-lazy-fixture/issues/65 --- benchmark/benchmark.py | 36 ++++++++++++++++++++---------------- requirements/dev.txt | 1 - 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index 478cccf4a..890e386b5 100644 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -1,7 +1,7 @@ import copy from typing import Any, Dict, List -from pytest import fixture, lazy_fixture, mark, param +from pytest import fixture, mark, param from omegaconf import OmegaConf from omegaconf._utils import ValueKind, _is_missing_literal, get_value_kind @@ -72,16 +72,17 @@ def small_listconfig(small_list: Any) -> Any: @mark.parametrize( - "data", + "data_fixture", [ - lazy_fixture("small_dict"), # type: ignore - lazy_fixture("large_dict"), # type: ignore - lazy_fixture("small_dict_config"), # type: ignore - lazy_fixture("large_dict_config"), # type: ignore - lazy_fixture("dict_config_with_list_leaf"), # type: ignore + "small_dict", + "large_dict", + "small_dict_config", + "large_dict_config", + "dict_config_with_list_leaf", ], ) -def test_omegaconf_create(data: Any, benchmark: Any) -> None: +def test_omegaconf_create(data_fixture: str, benchmark: Any, request: Any) -> None: + data = request.getfixturevalue(data_fixture) benchmark(OmegaConf.create, data) @@ -97,24 +98,27 @@ def test_omegaconf_merge(merge_function: Any, merge_data: Any, benchmark: Any) - @mark.parametrize( - "lst", + "lst_fixture", [ - lazy_fixture("small_list"), # type: ignore - lazy_fixture("small_listconfig"), # type: ignore + "small_list", + "small_listconfig", ], ) -def test_list_in(lst: List[Any], benchmark: Any) -> None: +def test_list_in(lst_fixture: str, benchmark: Any, request: Any) -> None: + lst: List[Any] = request.getfixturevalue(lst_fixture) benchmark(lambda seq, val: val in seq, lst, 10) @mark.parametrize( - "lst", + "lst_fixture", [ - lazy_fixture("small_list"), # type: ignore - lazy_fixture("small_listconfig"), # type: ignore + "small_list", + "small_listconfig", ], ) -def test_list_iter(lst: List[Any], benchmark: Any) -> None: +def test_list_iter(lst_fixture: str, benchmark: Any, request: Any) -> None: + lst: List[Any] = request.getfixturevalue(lst_fixture) + def iterate(seq: Any) -> None: for _ in seq: pass diff --git a/requirements/dev.txt b/requirements/dev.txt index 30bf623be..d8a16c142 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -12,7 +12,6 @@ pre-commit pyflakes pytest pytest-benchmark -pytest-lazy-fixture pytest-mock towncrier types-setuptools # makes mypy happy