-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pytest and pylint warnings #884
Conversation
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
756faf0
to
1504d0d
Compare
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
columns_values.append(series.values) | ||
if series.values.size and isinstance(series.values[0], np.bool_): | ||
# to avoid DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index | ||
columns_values.append(series.values.astype(int)) | ||
else: | ||
columns_values.append(series.values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/Users/runner/.local/lib/python3.8/site-packages/pypowsybl/utils/impl/dataframes.py:107: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
return _pp.create_dataframe(columns_values, columns_names, columns_types, is_index)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me. I spent some time looking at it a few monthes ago and never found the issue. But now looking at your fix, I understand. They just deprecated automatic conversion on numpy bool array to int array.
prettytable==2.0.0 | ||
prettytable==3.11.0 # last version supporting python 3.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ fixes these warning:
../../../../hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/prettytable/__init__.py:1
/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/prettytable/__init__.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
../../../../hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138
/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
../../../../hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138
../../../../hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138
../../../../hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138
../../../../hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138
/Users/runner/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py:3138: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
data=[['GEN', '', 'OTHER', 6.07, -100, 49.99, -100, 100, None, 'MIN_MAX', 1.02, 3.01, True, 'GEN', -3.03, | ||
data=[['GEN', '', 'OTHER', 6.07, -100, 49.99, -100, 100, nan, 'MIN_MAX', 1.02, 3.01, True, 'GEN', -3.03, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️
FutureWarning: Mismatched null-like values None and nan found. In a future version, pandas equality-testing functions (e.g. assert_frame_equal) will consider these not-matching and raise.
pd.testing.assert_frame_equal(expected, n.get_generators(), check_dtype=False, atol=1e-2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For another PR, but we should update our tests so that we don't need anymore check_dtype=False
Quality Gate passed for 'pypowsybl'Issues Measures |
Quality Gate passed for 'pypowsybl'Issues Measures |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Quality
What is the current behavior?
Many warnings, especially in pytest, making it hard for developers to spot whether new ones are introduced.
Some are real warnings to be adressed, others are pypowsybl deprecated features/apis warnings which should be filtered/checked because expected.
Also some pylint issues to be addressed if relevant.
pytest: 328 warnings
pylint: 9.84/10
pytest
pylint
What is the new behavior (if this is a feature change)?
pytest: 0 warnings
pylint: 9.95/10
Does this PR introduce a breaking change or deprecate an API?