Skip to content

Commit dde4e88

Browse files
committed
new ruff formatting fixes
1 parent 34de5a5 commit dde4e88

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

docs/configuration.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ you can specify a `pytest_robot_modify_options` hook in your `conftest.py` to pr
4545
from pytest_robotframework import RobotOptions
4646
from robot.api.interfaces import ListenerV3
4747

48-
class Foo(ListenerV3):
49-
...
48+
49+
class Foo(ListenerV3): ...
50+
5051

5152
def pytest_robot_modify_options(options: RobotOptions, session: Session) -> None:
5253
if not session.config.option.collectonly:
5354
options["loglevel"] = "DEBUG:INFO"
54-
options["listener"].append(Foo()) # you can specify instances as listeners, prerebotmodifiers, etc.
55+
options["listener"].append(
56+
Foo()
57+
) # you can specify instances as listeners, prerebotmodifiers, etc.
5558
```
5659

5760
note that not all arguments that the plugin passes to robot will be present in the `args` list. arguments required for the plugin to function (eg. the plugin's listeners and prerunmodifiers) cannot be viewed or modified with this hook
@@ -81,6 +84,7 @@ you may have existing `assert` statements in your codebase that are not intended
8184
```py
8285
from pytest_robotframework import AssertOptions, hide_asserts_from_robot_log
8386

87+
8488
def test_foo():
8589
# hide a single passing `assert` statement:
8690
assert foo == bar, AssertOptions(log_pass=False)
@@ -98,9 +102,10 @@ you can also run pytest with the `--no-assertions-in-robot-log` argument to disa
98102
```py
99103
from pytest_robotframework import AssertOptions
100104

105+
101106
def test_foo():
102-
assert "foo" == "bar" # hidden from the robot log (when run with --no-assertions-in-robot-log)
103-
assert "bar" == "baz", AssertOptions(log_pass=True) # not hidden
107+
assert "foo" == "bar" # hidden from the robot log (when run with --no-assertions-in-robot-log)
108+
assert "bar" == "baz", AssertOptions(log_pass=True) # not hidden
104109
```
105110

106111
### customizing assertions

docs/features.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ from pytest import Cache
77

88
from pytest_robotframework import keyword
99

10+
1011
@keyword # make this function show as a keyword in the robot log
11-
def foo():
12-
...
12+
def foo(): ...
13+
1314

1415
@mark.slow # markers get converted to robot tags
1516
def test_foo():
@@ -40,18 +41,20 @@ which is roughly equivalent to the following python code:
4041
# test_foo.py
4142
from pytest import mark
4243

44+
4345
@keyword
4446
def foo():
4547
logger.info("ran setup")
4648

49+
4750
@fixture(autouse=True)
4851
def setup():
4952
foo()
5053

54+
5155
@mark.asdf
5256
@mark.key("value")
53-
def test_bar():
54-
...
57+
def test_bar(): ...
5558
```
5659

5760
## setup/teardown
@@ -62,15 +65,16 @@ in pytest, setups and teardowns are defined using fixtures:
6265
from pytest import fixture
6366
from robot.api import logger
6467

68+
6569
@fixture
6670
def user():
6771
logger.info("logging in")
6872
user = ...
6973
yield user
7074
logger.info("logging off")
7175

72-
def test_something(user):
73-
...
76+
77+
def test_something(user): ...
7478
```
7579

7680
under the hood, pytest calls the fixture setup/teardown code as part of the `pytest_runtest_setup` and and `pytest_runtest_teardown` hooks, which appear in the robot log like so:
@@ -86,9 +90,10 @@ pytest markers are converted to tags in the robot log:
8690
```py
8791
from pytest import mark
8892

93+
8994
@mark.slow
9095
def test_blazingly_fast_sorting_algorithm():
91-
[1,2,3].sort()
96+
[1, 2, 3].sort()
9297
```
9398

9499
![](./images/tags-and-markers.png)
@@ -98,6 +103,7 @@ markers like `skip`, `skipif` and `parameterize` also work how you'd expect:
98103
```py
99104
from pytest import mark
100105

106+
101107
@mark.parametrize("test_input,expected", [(1, 8), (6, 6)])
102108
def test_eval(test_input: int, expected: int):
103109
assert test_input == expected
@@ -113,12 +119,8 @@ to set suite-level robot variables, call the `set_variables` function at the top
113119
from robot.libraries.BuiltIn import BuiltIn
114120
from pytest_robotframework import set_variables
115121

116-
set_variables(
117-
{
118-
"foo": "bar",
119-
"baz": ["a", "b"],
120-
}
121-
)
122+
set_variables({"foo": "bar", "baz": ["a", "b"]})
123+
122124

123125
def test_variables():
124126
assert BuiltIn().get_variable_value("$foo") == "bar"

docs/limitations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ if you want a function you wrote to show up as a keyword in the log, decorate it
1313
```py
1414
from pytest_robotframework import keyword
1515

16+
1617
@keyword
17-
def foo():
18-
...
18+
def foo(): ...
1919
```
2020

2121
### pytest functions are patched by the plugin
@@ -65,7 +65,7 @@ or if the exception is conditionally raised, use a `try`/`except` statement like
6565
try:
6666
some_keyword_that_fails()
6767
except SomeException:
68-
... # ignore the exception, or re-raise it later
68+
... # ignore the exception, or re-raise it later
6969
```
7070

7171
the keyword will still show as failed in the log (as long as it's decorated with `pytest_robotframework.keyword`), but it won't effect the status of the test unless the exception is re-raised.

0 commit comments

Comments
 (0)