Skip to content
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

[Fail on pytest warnings 1/n] Marking strings with invalid escape sequences as raw strings #31523

Merged
merged 4 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[pytest]
# Configure pytest to fail any test that raises an unexpected warning.
# This will enable us to catch usages of deprecated features in downstream libraries,
# before they are hard-deprecated.
# Furthermore, they will catch any test issues which may hide bugs.
# The format is `action:message_regex:category:module:line`.
filterwarnings =
# Fail builds on any unexpected warnings.
# See https://docs.google.com/document/d/1TVMfmhO0vD1MdkVrqRS9t4om2shMTY9nqdqqOopNv0M for more details.
error
ignore:.*:
2 changes: 1 addition & 1 deletion python/ray/_private/runtime_env/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def exec_worker(self, passthrough_args: List[str], language: Language):
else:
executable = "exec "

passthrough_args = [s.replace(" ", "\ ") for s in passthrough_args]
passthrough_args = [s.replace(" ", r"\ ") for s in passthrough_args]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO(cade) make sure this passes tests, unclear what the purpose of this line is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkooo567 do you know who has context on this line? I don't know enough about java args to say whether the fix is good

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exec_command = " ".join([f"{executable}"] + passthrough_args)
command_str = " ".join(self.command_prefix + [exec_command])
# TODO(SongGuyang): We add this env to command for macOS because it doesn't
Expand Down
2 changes: 1 addition & 1 deletion python/ray/air/util/tensor_extensions/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def name(self) -> str:

@classmethod
def construct_from_string(cls, string: str):
"""
r"""
Construct this type from a string.

This is useful mainly for data types that accept parameters.
Expand Down
2 changes: 1 addition & 1 deletion python/ray/data/grouped_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def count(self) -> Dataset[U]:
def sum(
self, on: Union[KeyFn, List[KeyFn]] = None, ignore_nulls: bool = True
) -> Dataset[U]:
"""Compute grouped sum aggregation.
r"""Compute grouped sum aggregation.

This is a blocking operation.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
Test that focuses on wide fanout of deployment graph
-> Node_1
/ \
Expand Down Expand Up @@ -56,7 +56,7 @@ def combine(value_refs):
def test_wide_fanout_deployment_graph(
fanout_degree, init_delay_secs=0, compute_delay_secs=0
):
"""
r"""
Test that focuses on wide fanout of deployment graph
-> Node_1
/ \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
This test is parity of
release/serve_tests/workloads/deployment_graph_wide_ensemble.py
Instead of using graph api, the test is using pure handle to
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/algorithm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ def get_multi_agent_setup(
spaces: Optional[Dict[PolicyID, Tuple[Space, Space]]] = None,
default_policy_class: Optional[Type[Policy]] = None,
) -> Tuple[MultiAgentPolicyConfigDict, Callable[[PolicyID, SampleBatchType], bool]]:
"""Compiles complete multi-agent config (dict) from the information in `self`.
r"""Compiles complete multi-agent config (dict) from the information in `self`.

Infers the observation- and action spaces, the policy classes, and the policy's
configs. The returned `MultiAgentPolicyConfigDict` is fully unified and strictly
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/dqn/dqn.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@


class DQNConfig(SimpleQConfig):
"""Defines a configuration class from which a DQN Algorithm can be built.
r"""Defines a configuration class from which a DQN Algorithm can be built.

Example:
>>> from ray.rllib.algorithms.dqn.dqn import DQNConfig
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/marwil/marwil.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def build(
) -> "Algorithm":
if not self._set_off_policy_estimation_methods:
deprecation_warning(
old="MARWIL used to have off_policy_estimation_methods "
old=r"MARWIL used to have off_policy_estimation_methods "
"is and wis by default. This has"
"changed to off_policy_estimation_methods: \{\}."
"If you want to use an off-policy estimator, specify it in"
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/mbmpo/mbmpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@


class MBMPOConfig(AlgorithmConfig):
"""Defines a configuration class from which an MBMPO Algorithm can be built.
r"""Defines a configuration class from which an MBMPO Algorithm can be built.

Example:
>>> from ray.rllib.algorithms.mbmpo import MBMPOConfig
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/r2d2/r2d2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class R2D2Config(DQNConfig):
"""Defines a configuration class from which a R2D2 Algorithm can be built.
r"""Defines a configuration class from which a R2D2 Algorithm can be built.

Example:
>>> from ray.rllib.algorithms.r2d2.r2d2 import R2D2Config
Expand Down