Skip to content

Commit

Permalink
chore(deps): update black requirement from ==23.* to ==24.* (#31)
Browse files Browse the repository at this point in the history
* chore(deps): update black requirement from ==23.* to ==24.*

Updates the requirements on [black](https://github.com/psf/black) to permit the latest version.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@23.1a1...24.1.1)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: reformat for updated black version

Signed-off-by: Daniel Neilson <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Daniel Neilson <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Neilson <[email protected]>
  • Loading branch information
dependabot[bot] and ddneilson authored Feb 5, 2024
1 parent a214f7a commit 3546caa
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 30 deletions.
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ mypy_path = "src"
plugins = "pydantic.mypy"

[tool.ruff]
line-length = 100

[tool.ruff.lint]
ignore = [
"E501",
# Double Check if this should be fixed
"E731",
]
line-length = 100


[tool.ruff.pep8-naming]
[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
"classmethod",
# pydantic decorators are classmethod decorators
Expand All @@ -123,7 +124,7 @@ classmethod-decorators = [
"pydantic.root_validator",
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = [
"openjd",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ pytest-cov == 4.1.*
pytest-timeout == 2.2.*
pytest-xdist == 3.5.*
types-PyYAML ~= 6.0
black == 23.*
black == 24.*
ruff == 0.2.*
mypy == 1.8.*
6 changes: 3 additions & 3 deletions src/openjd/cli/_summary/_summary_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ def output_summary_result(job: Job, step_name: str | None = None) -> OpenJDCliRe
message=f"Summary for Step '{step.name}' in Job '{job.name}'",
job_name=job.name,
step_name=step.name,
total_parameters=len(step.parameter_definitions)
if step.parameter_definitions
else 0,
total_parameters=(
len(step.parameter_definitions) if step.parameter_definitions else 0
),
parameter_definitions=step.parameter_definitions,
total_tasks=step.total_tasks,
total_environments=len(step.environments) if step.environments else 0,
Expand Down
33 changes: 21 additions & 12 deletions test/openjd/cli/test_local_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,23 @@ def patched_actions():
hang when mocking actions directly, so we just run the Session
to completion with short sample Jobs)
"""
with patch.object(
Session, "enter_environment", autospec=True, side_effect=Session.enter_environment
) as patched_enter, patch.object(
Session, "run_task", autospec=True, side_effect=Session.run_task
) as patched_run, patch.object(
Session, "exit_environment", autospec=True, side_effect=Session.exit_environment
) as patched_exit, patch.object(
LocalSession, "_action_callback", autospec=True, side_effect=LocalSession._action_callback
) as patched_callback:
with (
patch.object(
Session, "enter_environment", autospec=True, side_effect=Session.enter_environment
) as patched_enter,
patch.object(
Session, "run_task", autospec=True, side_effect=Session.run_task
) as patched_run,
patch.object(
Session, "exit_environment", autospec=True, side_effect=Session.exit_environment
) as patched_exit,
patch.object(
LocalSession,
"_action_callback",
autospec=True,
side_effect=LocalSession._action_callback,
) as patched_callback,
):
yield patched_enter, patched_run, patched_exit, patched_callback


Expand Down Expand Up @@ -192,9 +200,10 @@ def test_localsession_run_not_ready(sample_job_and_dirs: tuple):
"""
sample_job, template_dir, current_working_dir = sample_job_and_dirs
with LocalSession(job=sample_job, session_id="my-session") as session:
with patch.object(Session, "state", new=SessionState.ENDED), pytest.raises(
RuntimeError
) as rte:
with (
patch.object(Session, "state", new=SessionState.ENDED),
pytest.raises(RuntimeError) as rte,
):
session.run()

assert "not in a READY state" in str(rte.value)
Expand Down
13 changes: 8 additions & 5 deletions test/openjd/cli/test_run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,14 @@ def test_run_local_session_success(
destination_path=PurePosixPath("/mnt/test"),
)
]
with patch.object(
LocalSession, "initialize", autospec=True, side_effect=LocalSession.initialize
) as patched_initialize, patch.object(
Session, "__init__", autospec=True, side_effect=Session.__init__
) as patched_session_init:
with (
patch.object(
LocalSession, "initialize", autospec=True, side_effect=LocalSession.initialize
) as patched_initialize,
patch.object(
Session, "__init__", autospec=True, side_effect=Session.__init__
) as patched_session_init,
):
response = _run_local_session(
job=sample_job,
step_map=sample_step_map,
Expand Down
5 changes: 3 additions & 2 deletions test/openjd/cli/test_schema_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ def test_do_get_schema_error(capsys: pytest.CaptureFixture):
when generating the JSON schema.
"""

with patch.object(BaseModel, "schema", side_effect=RuntimeError("Test error")), pytest.raises(
SystemExit
with (
patch.object(BaseModel, "schema", side_effect=RuntimeError("Test error")),
pytest.raises(SystemExit),
):
do_get_schema(Namespace(version=SchemaVersion.v2023_09, output="human-readable"))
output = capsys.readouterr().out
Expand Down
7 changes: 4 additions & 3 deletions test/openjd/cli/test_summary_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ def test_do_summary_error():
Test that the `summary` command exits on any error (in this case, we mock an error in `read_template`)
"""
mock_args = Namespace(path=Path("some-file.json"), output="human-readable")
with patch(
"openjd.cli._common.read_template", new=Mock(side_effect=RuntimeError())
), pytest.raises(SystemExit):
with (
patch("openjd.cli._common.read_template", new=Mock(side_effect=RuntimeError())),
pytest.raises(SystemExit),
):
do_summary(mock_args)


Expand Down

0 comments on commit 3546caa

Please sign in to comment.