From e1bf418e722bc03acdbafea71f8332946099630e Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:34:07 +0545 Subject: [PATCH] tests: lazy tpi imports, ignore deprecation warning from setuptools (#9362) --- pyproject.toml | 2 ++ tests/func/machine/test_machine_config.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a86b3a891..b180a483e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,6 +149,8 @@ filterwarnings = [ # and https://github.com/celery/celery/issues/7528 # drop when celery==5.3 && kombu==5.3 releases "ignore:SelectableGroups dict interface is deprecated:DeprecationWarning", + # tpi imports pkg_resources + "ignore:pkg_resources is deprecated as an API:DeprecationWarning", # see https://github.com/networkx/networkx/issues/5723. "ignore:nx.nx_pydot.* depends on the pydot package, which has.*known issues and is not actively maintained:DeprecationWarning", # remove when new version of pytest-cov gets released diff --git a/tests/func/machine/test_machine_config.py b/tests/func/machine/test_machine_config.py index 0e5b775fb..3202b5017 100644 --- a/tests/func/machine/test_machine_config.py +++ b/tests/func/machine/test_machine_config.py @@ -2,7 +2,6 @@ import os import textwrap import pytest -import tpi from dvc.cli import main from dvc.ui import ui @@ -109,6 +108,8 @@ def test_machine_list(tmp_dir, dvc, capsys): def test_machine_rename_success(tmp_dir, scm, dvc, machine_config, capsys, mocker): + import tpi + config_file = tmp_dir / ".dvc" / "config" mocker.patch.object( @@ -147,6 +148,8 @@ def test_machine_rename_exist(tmp_dir, scm, dvc, caplog): def test_machine_rename_error(tmp_dir, scm, dvc, machine_config, caplog, mocker): + import tpi + config_file = tmp_dir / ".dvc" / "config" os.makedirs(tmp_dir / ".dvc" / "tmp" / "machine" / "terraform" / "foo")