Skip to content

Commit

Permalink
Add asyncio_default_fixture_loop_scope = "function" option (#318)
Browse files Browse the repository at this point in the history
`pytest-asyncio` has deprecated not providing a value for the
`asyncio_default_fixture_loop_scope` option. This commit adds a default
value of `"function"` for this option, as it was the previous default,
in the `pyproject.toml` files of this and all the generated projects.
  • Loading branch information
llucax authored Oct 25, 2024
2 parents 5e5b14d + b243695 commit 0adfc17
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* API projects updated the `frequenz-api-common` dependency to `0.6`.
* Update the SDK dependency to `1.0.0rc901`.
* Change `edit_uri` default branch to v0.x.x in mkdocs.yml.
* Added a new default option `asyncio_default_fixture_loop_scope = "function"` for `pytest-asyncio` as not providing a value is deprecated.

## Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ dev-pytest = [
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
{%- if cookiecutter.type != "api" %}
"pytest-mock == 3.14.0",
"pytest-asyncio == 0.23.7",
"pytest-asyncio == 0.24.0",
"async-solipsism == 0.6",
{%- endif %}
]
Expand Down Expand Up @@ -197,6 +197,7 @@ disable = [
{%- if cookiecutter.type != "api" %}
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
required_plugins = ["pytest-asyncio", "pytest-mock"]
{%- else %}
testpaths = ["pytests"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dev-pytest = [
"pylint == 3.2.5", # We need this to check for the examples
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
"pytest-mock == 3.14.0",
"pytest-asyncio == 0.23.7",
"pytest-asyncio == 0.24.0",
"async-solipsism == 0.6",
]
dev = [
Expand Down Expand Up @@ -155,6 +155,7 @@ disable = [
[tool.pytest.ini_options]
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
required_plugins = ["pytest-asyncio", "pytest-mock"]

[tool.mypy]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dev-pytest = [
"pylint == 3.2.5", # We need this to check for the examples
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
"pytest-mock == 3.14.0",
"pytest-asyncio == 0.23.7",
"pytest-asyncio == 0.24.0",
"async-solipsism == 0.6",
]
dev = [
Expand Down Expand Up @@ -154,6 +154,7 @@ disable = [
[tool.pytest.ini_options]
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
required_plugins = ["pytest-asyncio", "pytest-mock"]

[tool.mypy]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dev-pytest = [
"pylint == 3.2.5", # We need this to check for the examples
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
"pytest-mock == 3.14.0",
"pytest-asyncio == 0.23.7",
"pytest-asyncio == 0.24.0",
"async-solipsism == 0.6",
]
dev = [
Expand Down Expand Up @@ -151,6 +151,7 @@ disable = [
[tool.pytest.ini_options]
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
required_plugins = ["pytest-asyncio", "pytest-mock"]

[tool.mypy]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dev-pytest = [
"pylint == 3.2.5", # We need this to check for the examples
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
"pytest-mock == 3.14.0",
"pytest-asyncio == 0.23.7",
"pytest-asyncio == 0.24.0",
"async-solipsism == 0.6",
]
dev = [
Expand Down Expand Up @@ -155,6 +155,7 @@ disable = [
[tool.pytest.ini_options]
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
required_plugins = ["pytest-asyncio", "pytest-mock"]

[tool.mypy]
Expand Down

0 comments on commit 0adfc17

Please sign in to comment.