tests: filter warnings (#9115)

This commit is contained in:
skshetry
2023-03-06 15:41:45 +05:45
committed by GitHub
parent 1d2892efac
commit e7d4f5b24e
7 changed files with 50 additions and 29 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ import typing
from collections import defaultdict
from typing import Dict
import dpath.util
import dpath
from voluptuous import Any
from dvc.exceptions import DvcException
@@ -87,17 +87,17 @@ class ParamsDependency(Dependency):
if flatten:
for param in self.params:
try:
ret[param] = dpath.util.get(config, param, separator=".")
ret[param] = dpath.get(config, param, separator=".")
except KeyError:
continue
return ret
from dpath.util import merge
from dpath import merge
for param in self.params:
merge(
ret,
dpath.util.search(config, param, separator="."),
dpath.search(config, param, separator="."),
separator=".",
)
return ret
+1 -1
View File
@@ -1,8 +1,8 @@
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, List, Optional
import dpath
import dpath.options
import dpath.util
from funcy import last
from dvc.repo.plots import infer_data_sources
+9 -9
View File
@@ -18,8 +18,8 @@ from typing import (
Union,
)
import dpath
import dpath.options
import dpath.util
from funcy import distinct, first, project
from dvc.exceptions import DvcException
@@ -389,7 +389,7 @@ def _collect_output_plots(repo, targets, props, onerror: Optional[Callable] = No
onerror=onerror,
)
dpath.util.merge(
dpath.merge(
result,
{"": unpacked},
)
@@ -436,13 +436,13 @@ def _resolve_definitions(
props={**plot_props, **props},
onerror=onerror,
)
dpath.util.merge(
dpath.merge(
result,
unpacked,
)
elif _matches(targets, config_path, plot_id):
adjusted_props = _adjust_sources(fs, plot_props, config_dir)
dpath.util.merge(result, {"data": {plot_id: {**adjusted_props, **props}}})
dpath.merge(result, {"data": {plot_id: {**adjusted_props, **props}}})
return result
@@ -471,7 +471,7 @@ def _collect_pipeline_files(repo, targets: List[str], props, onerror=None):
dvcfile_defs_dict,
onerror=onerror,
)
dpath.util.merge(
dpath.merge(
result,
{dvcfile_path: resolved},
)
@@ -495,13 +495,13 @@ def _collect_definitions(
fs = DVCFileSystem(repo=repo)
if not config_files:
dpath.util.merge(
dpath.merge(
result,
_collect_pipeline_files(repo, targets, props, onerror=onerror),
)
if targets or (not targets and not config_files):
dpath.util.merge(
dpath.merge(
result,
_collect_output_plots(repo, targets, props, onerror=onerror),
)
@@ -518,7 +518,7 @@ def _collect_definitions(
definitions,
onerror=onerror,
)
dpath.util.merge(
dpath.merge(
result,
{path: resolved},
)
@@ -526,7 +526,7 @@ def _collect_definitions(
for target in targets:
if not result or fs.exists(target):
unpacked = unpack_if_dir(fs, target, props=props, onerror=onerror)
dpath.util.merge(result[""], unpacked)
dpath.merge(result[""], unpacked)
return dict(result)
+1 -1
View File
@@ -169,7 +169,7 @@ def determine_linecol(
number of steps upward to just 5. If it does not find any linecols, it'll
abort.
"""
from dpath.util import get
from dpath import get
step = 1
line, col = None, None
+23 -2
View File
@@ -34,7 +34,7 @@ dependencies = [
"colorama>=0.3.9",
"configobj>=5.0.6",
"distro>=1.3",
"dpath<3,>=2.0.2",
"dpath<3,>=2.1.0",
"dvc-data>=0.42.1,<0.43",
"dvc-http",
"dvc-render>=0.1.2",
@@ -132,7 +132,28 @@ profile = "black"
[tool.pytest.ini_options]
addopts = "-ra --cov-config pyproject.toml"
filterwarnings = ["error::pytest_mock.PytestMockWarning"]
filterwarnings = [
"error::pytest_mock.PytestMockWarning",
# remove when aiobotocore supports botocore>=1.29.13
"ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning",
# also relates to botocore, but looks like it's not going to be fixed
# https://github.com/boto/botocore/issues/2744
"ignore:'urllib3.contrib.pyopenssl' module is deprecated:DeprecationWarning",
# ruamel.yaml: https://sourceforge.net/p/ruamel-yaml/tickets/452/
# google.cloud: https://github.com/googleapis/python-storage/issues/1000
# google.logging: https://github.com/googleapis/python-logging/issues/730
# Also happens with `zc.lockfile`.
"ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning",
# see https://github.com/celery/kombu/issues/1339
# and https://github.com/celery/celery/issues/7528
# drop when celery==5.3 && kombu==5.3 releases
"ignore:SelectableGroups dict interface is deprecated: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
# https://github.com/pytest-dev/pytest-cov/issues/557
"ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated:DeprecationWarning",
]
log_level = "debug"
markers = [
"needs_internet: Might need network access for the tests",
+9 -9
View File
@@ -5,7 +5,7 @@ from typing import Dict, List
from urllib.parse import urlparse
from urllib.request import url2pathname
import dpath.util
import dpath
import pytest
from bs4 import BeautifulSoup
from funcy import first
@@ -124,9 +124,9 @@ def verify_vega(
tmp1 = deepcopy(html_template)
tmp2 = deepcopy(filled_template)
tmp3 = deepcopy(split_template)
dpath.util.set(tmp1, path, {})
dpath.util.set(tmp2, path, {})
dpath.util.set(tmp3, path, {})
dpath.set(tmp1, path, {})
dpath.set(tmp2, path, {})
dpath.set(tmp3, path, {})
assert tmp1 == tmp2 == tmp3
@@ -140,17 +140,17 @@ def verify_vega_props(plot_id, json_result, title, x, y, **kwargs):
assert len(data) == 1
data = first(data)
assert dpath.util.get(data, ["content", "title"]) == title
assert dpath.get(data, ["content", "title"]) == title
try:
# TODO confusion_matrix_plot - need to find better way of asserting
# encoding as its place is not constant in vega
plot_x = dpath.util.get(data, ["content", "spec", "encoding", "x", "field"])
plot_y = dpath.util.get(data, ["content", "spec", "encoding", "y", "field"])
plot_x = dpath.get(data, ["content", "spec", "encoding", "x", "field"])
plot_y = dpath.get(data, ["content", "spec", "encoding", "y", "field"])
except KeyError:
# default plot
plot_x = dpath.util.get(data, ["content", "layer", 0, "encoding", "x", "field"])
plot_y = dpath.util.get(data, ["content", "layer", 0, "encoding", "y", "field"])
plot_x = dpath.get(data, ["content", "layer", 0, "encoding", "x", "field"])
plot_y = dpath.get(data, ["content", "layer", 0, "encoding", "y", "field"])
assert plot_x == x
assert plot_y == y
+3 -3
View File
@@ -1,9 +1,9 @@
import dpath.util
import dpath
dpath.options.ALLOW_EMPTY_STRING_KEYS = True
def get_plot(plots_data, revision, typ="sources", file=None, endkey="data"):
if file is not None:
return dpath.util.get(plots_data, [revision, typ, "data", file, endkey])
return dpath.util.get(plots_data, [revision, typ, endkey])
return dpath.get(plots_data, [revision, typ, "data", file, endkey])
return dpath.get(plots_data, [revision, typ, endkey])