Skip to content

Commit 87b9e82

Browse files
committed
chore: run pre-commit on all files
1 parent e7b56ce commit 87b9e82

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

HACKING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ The main improvements in this release are ...
466466
Read more in the [full release notes on GitHub](link to the GitHub release).
467467
```
468468

469-
In the post, outline the key improvements both in `ops` and `ops-scenario` -
469+
In the post, outline the key improvements both in `ops` and `ops-scenario` -
470470
the point here is to encourage people to check out the full notes and to upgrade
471471
promptly, so ensure that you entice them with the best that the new versions
472472
have to offer.

testing/CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To set up the dependencies you can run:
3939

4040
We recommend using the provided `pre-commit` config. For how to set up git pre-commit: [see here](https://pre-commit.com/).
4141
If you dislike that, you can always manually remember to `tox -e lint` before you push.
42-
42+
4343
### Testing
4444
```shell
4545
tox -e fmt # auto-fix your code as much as possible, including formatting and linting
@@ -48,4 +48,3 @@ tox -e unit # unit tests
4848
tox -e lint-tests # lint testing code
4949
tox # runs 'lint', 'lint-tests' and 'unit' environments
5050
```
51-

testing/README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Comparing scenario tests with `Harness` tests:
6666
A scenario test consists of three broad steps:
6767

6868
- **Arrange**:
69-
- declare the context
69+
- declare the context
7070
- declare the input state
7171
- select an event to fire
7272
- **Act**:
@@ -173,7 +173,7 @@ def test_statuses():
173173
scenario.WaitingStatus('checking this is right...'),
174174
]
175175
assert out.unit_status == scenario.ActiveStatus("I am ruled")
176-
176+
177177
# similarly you can check the app status history:
178178
assert ctx.app_status_history == [
179179
scenario.UnknownStatus(),
@@ -241,7 +241,7 @@ def test_foo():
241241

242242
You can configure what events will be captured by passing the following arguments to `Context`:
243243
- `capture_deferred_events`: If you want to include re-emitted deferred events.
244-
- `capture_framework_events`: If you want to include framework events (`pre-commit`, `commit`, and `collect-status`).
244+
- `capture_framework_events`: If you want to include framework events (`pre-commit`, `commit`, and `collect-status`).
245245

246246
For example:
247247
```python
@@ -360,10 +360,10 @@ ctx.run(ctx.on.start(), state_in) # invalid: this unit's id cannot be the ID of
360360

361361
To declare a subordinate relation, you should use `scenario.SubordinateRelation`. The core difference with regular
362362
relations is that subordinate relations always have exactly one remote unit (there is always exactly one remote unit
363-
that this unit can see).
363+
that this unit can see).
364364
Because of that, `SubordinateRelation`, compared to `Relation`, always talks in terms of `remote`:
365365

366-
- `Relation.remote_units_data` becomes `SubordinateRelation.remote_unit_data` taking a single `Dict[str:str]`. The remote unit ID can be provided as a separate argument.
366+
- `Relation.remote_units_data` becomes `SubordinateRelation.remote_unit_data` taking a single `Dict[str:str]`. The remote unit ID can be provided as a separate argument.
367367
- `Relation.remote_unit_ids` becomes `SubordinateRelation.remote_unit_id` (a single ID instead of a list of IDs)
368368
- `Relation.remote_units_data` becomes `SubordinateRelation.remote_unit_data` (a single databag instead of a mapping from unit IDs to databags)
369369

@@ -414,10 +414,10 @@ remote_unit_2_is_joining_event = ctx.on.relation_joined(relation, remote_unit=2)
414414

415415
## Networks
416416

417-
Simplifying a bit the Juju "spaces" model, each integration endpoint a charm defines in its metadata is associated with a network. Regardless of whether there is a living relation over that endpoint, that is.
417+
Simplifying a bit the Juju "spaces" model, each integration endpoint a charm defines in its metadata is associated with a network. Regardless of whether there is a living relation over that endpoint, that is.
418418

419419
If your charm has a relation `"foo"` (defined in its metadata), then the charm will be able at runtime to do `self.model.get_binding("foo").network`.
420-
The network you'll get by doing so is heavily defaulted (see `state.Network`) and good for most use-cases because the charm should typically not be concerned about what IP it gets.
420+
The network you'll get by doing so is heavily defaulted (see `state.Network`) and good for most use-cases because the charm should typically not be concerned about what IP it gets.
421421

422422
On top of the relation-provided network bindings, a charm can also define some `extra-bindings` in its metadata and access them at runtime. Note that this is a deprecated feature that should not be relied upon. For completeness, we support it in Scenario.
423423

@@ -540,7 +540,7 @@ def test_pebble_push():
540540
MyCharm,
541541
meta={"name": "foo", "containers": {"foo": {}}}
542542
)
543-
543+
544544
ctx.run(ctx.on.start(), state_in)
545545

546546
# This is the root of the simulated container filesystem. Any mounts will be symlinks in it.
@@ -724,7 +724,7 @@ ctx.run(ctx.on.storage_attached(foo_1), scenario.State(storages={foo_0, foo_1}))
724724

725725
## Ports
726726

727-
Since `ops 2.6.0`, charms can invoke the `open-port`, `close-port`, and `opened-ports` hook tools to manage the ports opened on the host VM/container. Using the `State.opened_ports` API, you can:
727+
Since `ops 2.6.0`, charms can invoke the `open-port`, `close-port`, and `opened-ports` hook tools to manage the ports opened on the host VM/container. Using the `State.opened_ports` API, you can:
728728

729729
- simulate a charm run with a port opened by some previous execution
730730
ctx = scenario.Context(MyCharm, meta=MyCharm.META)
@@ -941,7 +941,7 @@ How to test actions with scenario:
941941
def test_backup_action():
942942
ctx = scenario.Context(MyCharm)
943943

944-
# If you didn't declare do_backup in the charm's metadata,
944+
# If you didn't declare do_backup in the charm's metadata,
945945
# the `ConsistencyChecker` will slap you on the wrist and refuse to proceed.
946946
state = ctx.run(ctx.on.action("do_backup"), scenario.State())
947947

@@ -979,7 +979,7 @@ If the action takes parameters, you can pass those in the call.
979979
def test_backup_action():
980980
ctx = scenario.Context(MyCharm)
981981

982-
# If the parameters (or their type) don't match what is declared in the metadata,
982+
# If the parameters (or their type) don't match what is declared in the metadata,
983983
# the `ConsistencyChecker` will slap you on the other wrist.
984984
state = ctx.run(
985985
ctx.on.action("do_backup", params={'a': 'b'}),
@@ -1052,7 +1052,7 @@ from charms.bar.lib_name.v1.charm_lib import CharmLib
10521052
class MyCharm(ops.CharmBase):
10531053
META = {"name": "mycharm"}
10541054
_stored = ops.StoredState()
1055-
1055+
10561056
def __init__(self, framework):
10571057
super().__init__(framework)
10581058
self._stored.set_default(a="a")
@@ -1068,15 +1068,15 @@ def test_live_charm_introspection(mycharm):
10681068
with ctx(ctx.on.start(), scenario.State()) as manager:
10691069
# This is your charm instance, after ops has set it up:
10701070
charm: MyCharm = manager.charm
1071-
1071+
10721072
# We can check attributes on nested Objects or the charm itself:
10731073
assert charm.my_charm_lib.foo == "foo"
10741074
# such as stored state:
10751075
assert charm._stored.a == "a"
10761076

10771077
# This will tell ops.main to proceed with normal execution and emit the "start" event on the charm:
10781078
state_out = manager.run()
1079-
1079+
10801080
# After that is done, we are handed back control, and we can again do some introspection:
10811081
assert charm.my_charm_lib.foo == "bar"
10821082
# and check that the charm's internal state is as we expect:
@@ -1181,6 +1181,6 @@ don't need that.
11811181
# Jhack integrations
11821182

11831183
Up until `v5.6.0`, Scenario shipped with a cli tool called `snapshot`, used to interact with a live charm's state.
1184-
The functionality [has been moved over to `jhack`](https://github.com/PietroPasotti/jhack/pull/111),
1185-
to allow us to keep working on it independently, and to streamline
1184+
The functionality [has been moved over to `jhack`](https://github.com/PietroPasotti/jhack/pull/111),
1185+
to allow us to keep working on it independently, and to streamline
11861186
the profile of Scenario itself as it becomes more broadly adopted and ready for widespread usage.

testing/tests/test_e2e/test_pebble.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,23 @@ def callback(self: CharmBase):
162162

163163

164164
LS = """
165-
.rw-rw-r-- 228 ubuntu ubuntu 18 jan 12:05 -- charmcraft.yaml
166-
.rw-rw-r-- 497 ubuntu ubuntu 18 jan 12:05 -- config.yaml
167-
.rw-rw-r-- 900 ubuntu ubuntu 18 jan 12:05 -- CONTRIBUTING.md
168-
drwxrwxr-x - ubuntu ubuntu 18 jan 12:06 -- lib
169-
.rw-rw-r-- 11k ubuntu ubuntu 18 jan 12:05 -- LICENSE
170-
.rw-rw-r-- 1,6k ubuntu ubuntu 18 jan 12:05 -- metadata.yaml
171-
.rw-rw-r-- 845 ubuntu ubuntu 18 jan 12:05 -- pyproject.toml
172-
.rw-rw-r-- 831 ubuntu ubuntu 18 jan 12:05 -- README.md
173-
.rw-rw-r-- 13 ubuntu ubuntu 18 jan 12:05 -- requirements.txt
174-
drwxrwxr-x - ubuntu ubuntu 18 jan 12:05 -- src
175-
drwxrwxr-x - ubuntu ubuntu 18 jan 12:05 -- tests
176-
.rw-rw-r-- 1,9k ubuntu ubuntu 18 jan 12:05 -- tox.ini
165+
.rw-rw-r-- 228 ubuntu ubuntu 18 jan 12:05 -- charmcraft.yaml
166+
.rw-rw-r-- 497 ubuntu ubuntu 18 jan 12:05 -- config.yaml
167+
.rw-rw-r-- 900 ubuntu ubuntu 18 jan 12:05 -- CONTRIBUTING.md
168+
drwxrwxr-x - ubuntu ubuntu 18 jan 12:06 -- lib
169+
.rw-rw-r-- 11k ubuntu ubuntu 18 jan 12:05 -- LICENSE
170+
.rw-rw-r-- 1,6k ubuntu ubuntu 18 jan 12:05 -- metadata.yaml
171+
.rw-rw-r-- 845 ubuntu ubuntu 18 jan 12:05 -- pyproject.toml
172+
.rw-rw-r-- 831 ubuntu ubuntu 18 jan 12:05 -- README.md
173+
.rw-rw-r-- 13 ubuntu ubuntu 18 jan 12:05 -- requirements.txt
174+
drwxrwxr-x - ubuntu ubuntu 18 jan 12:05 -- src
175+
drwxrwxr-x - ubuntu ubuntu 18 jan 12:05 -- tests
176+
.rw-rw-r-- 1,9k ubuntu ubuntu 18 jan 12:05 -- tox.ini
177177
"""
178178
PS = """
179-
PID TTY TIME CMD
180-
298238 pts/3 00:00:04 zsh
181-
1992454 pts/3 00:00:00 ps
179+
PID TTY TIME CMD
180+
298238 pts/3 00:00:04 zsh
181+
1992454 pts/3 00:00:00 ps
182182
"""
183183

184184

0 commit comments

Comments
 (0)