Skip to content

Commit 932e1a1

Browse files
authored
chore: configure independent pytest settings per subpackage (#278)
* chore: configure independent pytest settings per subpackage - Add [tool.pytest.ini_options] to each package's pyproject.toml - Update conftest.py in each package to declare pytest_plugins directly - Remove root-level conftest.py (no longer needed) - Remove testpaths from root pyproject.toml This enables running tests independently per package without relying on root-level configuration. * update out of date comments
1 parent 3045208 commit 932e1a1

File tree

10 files changed

+26
-29
lines changed

10 files changed

+26
-29
lines changed

conftest.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/data-designer-config/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ packages = ["src/data_designer"]
4848
[tool.ruff]
4949
extend = "../../pyproject.toml"
5050

51+
[tool.pytest.ini_options]
52+
testpaths = ["tests"]
53+
asyncio_default_fixture_loop_scope = "session"
54+
env = ["DISABLE_DATA_DESIGNER_PLUGINS=true"]
55+
5156
[tool.uv]
5257
package = true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Fixtures are loaded via root conftest.py's pytest_plugins declaration
4+
pytest_plugins = ["data_designer.config.testing.fixtures"]

packages/data-designer-engine/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ packages = ["src/data_designer"]
5858
[tool.ruff]
5959
extend = "../../pyproject.toml"
6060

61+
[tool.pytest.ini_options]
62+
testpaths = ["tests"]
63+
asyncio_default_fixture_loop_scope = "session"
64+
env = ["DISABLE_DATA_DESIGNER_PLUGINS=true"]
65+
6166
[tool.uv]
6267
package = true
6368

packages/data-designer-engine/src/data_designer/engine/testing/fixtures.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
"""Pytest fixtures for engine testing.
55
6-
This module is registered as a pytest plugin in the root conftest.py per pytest best practices.
7-
https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-files
6+
Located in src/ so it can be packaged and shared across subpackages via pytest_plugins.
87
"""
98

109
from __future__ import annotations
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Fixtures are loaded via root conftest.py's pytest_plugins declaration
4+
pytest_plugins = [
5+
"data_designer.config.testing.fixtures",
6+
"data_designer.engine.testing.fixtures",
7+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Fixtures are loaded via root conftest.py's pytest_plugins declaration
4+
# Fixtures are loaded via pytest_plugins in this package's top-level tests/conftest.py.

packages/data-designer/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ packages = ["src/data_designer"]
5050
[tool.ruff]
5151
extend = "../../pyproject.toml"
5252

53+
[tool.pytest.ini_options]
54+
testpaths = ["tests"]
55+
asyncio_default_fixture_loop_scope = "session"
56+
env = ["DISABLE_DATA_DESIGNER_PLUGINS=true"]
57+
5358
[tool.uv]
5459
package = true
5560

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Fixtures are loaded via root conftest.py's pytest_plugins declaration
4+
pytest_plugins = [
5+
"data_designer.config.testing.fixtures",
6+
"data_designer.engine.testing.fixtures",
7+
]

pyproject.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ recipes = [
6868
]
6969

7070
[tool.pytest.ini_options]
71-
testpaths = [
72-
"packages/data-designer-config/tests",
73-
"packages/data-designer-engine/tests",
74-
"packages/data-designer/tests",
75-
]
7671
asyncio_default_fixture_loop_scope = "session"
7772
env = ["DISABLE_DATA_DESIGNER_PLUGINS=true"]
7873

0 commit comments

Comments
 (0)