Skip to content

Commit 5ac1268

Browse files
authored
Stop hardcoding relative paths to pyproject.toml (#29108)
We set a root pyproject.toml with some pytest settings in it. And then, by convention, we call `pytest -c {relative_path}/pyproject.toml` But we do that really inconsistently. Some have their own pyproject.toml that we accidentally point at (either by messing up a relative path or via auto discovery). None of these other pyproject.toml files have their own pytest configuration so we're just pre-empting our global one. This switches us to setting a `PYTEST_ADDOPTS` env var that we pass through in buildkite to all build steps. And adds lints to make sure we're not accidentally subverting it.
1 parent a1a9802 commit 5ac1268

File tree

116 files changed

+253
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+253
-129
lines changed

Diff for: .buildkite/dagster-buildkite/dagster_buildkite/step_builder.py

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def on_python_image(
8585
if env.startswith("BUILDKITE") or env.startswith("CI_")
8686
]
8787
buildkite_envvars.append("BUILDKITE_ANALYTICS_TOKEN")
88+
buildkite_envvars.append("PYTEST_ADDOPTS")
8889

8990
# Set PYTEST_DEBUG_TEMPROOT to our mounted /tmp volume. Any time the
9091
# pytest `tmp_path` or `tmpdir` fixtures are used used, the temporary

Diff for: .buildkite/dagster-buildkite/lints.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ def find_tox_ini():
1919
def tox_config(request):
2020
config = configparser.ConfigParser()
2121
config.read(request.param)
22+
23+
assert "testenv" in config
24+
assert "passenv" in config["testenv"]
25+
2226
return config
2327

2428

2529
def test_tox_passenv(tox_config):
2630
PASSENV_ENV = [
2731
"BUILDKITE*",
32+
"PYTEST_ADDOPTS",
2833
"PYTEST_PLUGINS",
2934
]
3035

31-
assert "testenv" in tox_config
32-
assert "passenv" in tox_config["testenv"]
33-
3436
missing_env = []
3537
for env in PASSENV_ENV:
3638
if env not in tox_config["testenv"]["passenv"].split("\n"):
@@ -47,3 +49,10 @@ def test_no_subdirectory_pytest_ini():
4749
pytest_ini_files.append(pytest_ini_file)
4850

4951
assert not pytest_ini_files, f"Subdirectory pytest.ini files conflict with our root pyproject.toml settings and conftest.py discovery. Please remove: {pytest_ini_files}"
52+
53+
54+
def test_no_tox_pytest_config_override(tox_config):
55+
if "commands" in tox_config["testenv"]:
56+
assert (
57+
"pyproject.toml" not in tox_config["testenv"]["commands"]
58+
), "We use a global PYTEST_CONFIG that uses the root directory's pyproject.toml. Remove any -c overrides in pytest commands in tox.ini"

Diff for: .buildkite/hooks/pre-command

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ set -eu
33
. ./.buildkite/scripts/docker_prune.sh
44

55
export BUILDKITE_ANALYTICS_TOKEN=$DAGSTER_BUILDKITE_TEST_ANALYTICS_TOKEN
6+
export PYTEST_ADDOPTS="-c /workdir/pyproject.toml"

Diff for: docs/sphinx/_ext/dagster-sphinx/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ download = True
66
passenv =
77
CI_PULL_REQUEST
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
allowlist_externals =
1112
/bin/bash
1213
commands =
1314
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
14-
pytest -c ../../pyproject.toml -vv {posargs}
15+
pytest -vv {posargs}

Diff for: docs/sphinx/_ext/sphinx-click/tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ envlist = py{38,39,310,311,312}-click{8,8-async},style,docs
55
[testenv]
66
passenv =
77
BUILDKITE*
8+
PYTEST_ADDOPTS
89
PYTEST_PLUGINS
910
setenv =
1011
PYTHONDEVMODE = 1

Diff for: docs/sphinx/_ext/sphinx-mdx-builder/tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ envlist =
1010
[testenv]
1111
passenv =
1212
BUILDKITE*
13+
PYTEST_ADDOPTS
1314
PYTEST_PLUGINS
1415

1516
basepython =

Diff for: docs/tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ passenv =
1010
AWS_ACCESS_KEY_ID
1111
BUILDKITE*
1212
LC_ALL
13+
PYTEST_ADDOPTS
1314
PYTEST_PLUGINS
1415
allowlist_externals =
1516
make

Diff for: examples/airlift-federation-tutorial/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -27,4 +28,4 @@ commands =
2728
# We need to rebuild the UI to ensure that the dagster-webserver can run
2829
make -C ../.. rebuild_ui
2930
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
30-
pytest -c ./pyproject.toml ./airlift_federation_tutorial_tests --snapshot-warn-unused -vv {posargs}
31+
pytest ./airlift_federation_tutorial_tests --snapshot-warn-unused -vv {posargs}

Diff for: examples/airlift-migration-tutorial/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -27,4 +28,4 @@ commands =
2728
# We need to rebuild the UI to ensure that the dagster-webserver can run
2829
make -C ../.. rebuild_ui
2930
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
30-
pytest -c ../../pyproject.toml ./tutorial_example_tests --snapshot-warn-unused -vv {posargs}
31+
pytest ./tutorial_example_tests --snapshot-warn-unused -vv {posargs}

Diff for: examples/assets_dbt_python/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
; note: "source" does not work at this time due to dagster-cloud source access
@@ -26,4 +27,4 @@ allowlist_externals =
2627
uv
2728
commands =
2829
source: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
29-
pytest -c ../../pyproject.toml -vv
30+
pytest -vv

Diff for: examples/assets_dynamic_partitions/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -20,4 +21,4 @@ allowlist_externals =
2021
uv
2122
commands =
2223
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
23-
pytest -c ../../pyproject.toml -vv
24+
pytest -vv

Diff for: examples/assets_modern_data_stack/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
; note: "source" does not work at this time due to dagster-cloud source access
@@ -27,4 +28,4 @@ allowlist_externals =
2728
uv
2829
commands =
2930
source: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
30-
pytest -c ../../pyproject.toml -vv
31+
pytest -vv

Diff for: examples/assets_pandas_pyspark/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install -b ../../python_modules/libraries/dagster-pyspark/build-constraints {opts} {packages}
1112
deps =
@@ -22,4 +23,4 @@ allowlist_externals =
2223
uv
2324
commands =
2425
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
25-
pytest -c ../../pyproject.toml -vv
26+
pytest -vv

Diff for: examples/assets_pandas_type_metadata/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -21,4 +22,4 @@ allowlist_externals =
2122
uv
2223
commands =
2324
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
24-
pytest -c ../../pyproject.toml -vv
25+
pytest -vv

Diff for: examples/assets_smoke_test/tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =

Diff for: examples/deploy_docker/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ passenv =
77
CI_*
88
BUILDKITE*
99
DEPLOY_DOCKER_WEBSERVER_HOST
10+
PYTEST_ADDOPTS
1011
PYTEST_PLUGINS
1112
install_command = uv pip install {opts} {packages}
1213
deps =
@@ -18,4 +19,4 @@ allowlist_externals =
1819
uv
1920
commands =
2021
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
21-
pytest -c ../../pyproject.toml -vv {posargs}
22+
pytest -vv {posargs}

Diff for: examples/deploy_ecs/tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ passenv =
77
CI_*
88
BUILDKITE*
99
DEPLOY_DOCKER_WEBSERVER_HOST
10+
PYTEST_ADDOPTS
1011
PYTEST_PLUGINS
1112
install_command = uv pip install {opts} {packages}
1213
deps =

Diff for: examples/development_to_production/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -22,4 +23,4 @@ allowlist_externals =
2223
uv
2324
commands =
2425
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
25-
pytest -c ../../pyproject.toml -vv {posargs}
26+
pytest -vv {posargs}

Diff for: examples/docs_snippets/tox.ini

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ passenv =
99
BUILDKITE*
1010
EXTRA_PARAMS
1111
DAGSTER_CLI_SNIPPET_WORKING_DIR
12+
PYTEST_ADDOPTS
1213
PYTEST_PLUGINS
1314
; dagstermill test errors prevent using uv, require compat mode install
1415
; install_command = uv pip install {opts} {packages}
@@ -90,15 +91,15 @@ commands =
9091
all: uv pip install dagster-cloud --no-deps
9192
all: uv pip install path
9293
all: /bin/bash -c '! pip list --exclude-editable | grep -e dagster | grep -v dagster-cloud'
93-
all: pytest -c ../../pyproject.toml -vv {posargs} --ignore=docs_snippets_tests/test_integration_files_load.py --ignore=docs_snippets_tests/snippet_checks
94+
all: pytest -vv {posargs} --ignore=docs_snippets_tests/test_integration_files_load.py --ignore=docs_snippets_tests/snippet_checks
9495

9596
integrations: uv pip install dagster-cloud-cli --no-deps
9697
integrations: uv pip install dagster-cloud --no-deps
9798
integrations: uv pip install path
9899
integrations: /bin/bash -c '! pip list --exclude-editable | grep -e dagster | grep -v dagster-cloud'
99-
integrations: pytest -c ../../pyproject.toml -vv {posargs} docs_snippets_tests/test_integration_files_load.py
100+
integrations: pytest -vv {posargs} docs_snippets_tests/test_integration_files_load.py
100101

101102
docs_snapshot_test: sh ./docs_snippets_tests/ensure_snapshot_deps.sh
102-
docs_snapshot_test: pytest -c ../../pyproject.toml -vv {posargs} docs_snippets_tests/snippet_checks
103+
docs_snapshot_test: pytest -vv {posargs} docs_snippets_tests/snippet_checks
103104
docs_snapshot_update: sh ./docs_snippets_tests/ensure_snapshot_deps.sh
104-
docs_snapshot_update: pytest -c ../../pyproject.toml -vv {posargs} docs_snippets_tests/snippet_checks --update-snippets {env:EXTRA_PARAMS}
105+
docs_snapshot_update: pytest -vv {posargs} docs_snippets_tests/snippet_checks --update-snippets {env:EXTRA_PARAMS}

Diff for: examples/experimental/assets_yaml_dsl/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -20,4 +21,4 @@ allowlist_externals =
2021
uv
2122
commands =
2223
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
23-
pytest -c ../../../pyproject.toml -vv
24+
pytest -vv

Diff for: examples/experimental/dagster-dlift/kitchen-sink/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ passenv =
77
CI_*
88
BUILDKITE*
99
KS_DBT_CLOUD*
10+
PYTEST_ADDOPTS
1011
PYTEST_PLUGINS
1112
install_command = uv pip install {opts} {packages}
1213
deps =
@@ -28,4 +29,4 @@ commands =
2829
# We need to rebuild the UI to ensure that the dagster-webserver can run
2930
make -C ../../../.. rebuild_ui
3031
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
31-
pytest -c ../../../pyproject.toml ./dlift_kitchen_sink_tests --snapshot-warn-unused -vv {posargs}
32+
pytest ./dlift_kitchen_sink_tests --snapshot-warn-unused -vv {posargs}

Diff for: examples/experimental/dagster-dlift/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -24,4 +25,4 @@ commands =
2425
# We need to rebuild the UI to ensure that the dagster-webserver can run
2526
make -C ../../.. rebuild_ui
2627
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
27-
pytest -c ../../../pyproject.toml ./dagster_dlift_tests --snapshot-warn-unused -vv {posargs}
28+
pytest ./dagster_dlift_tests --snapshot-warn-unused -vv {posargs}

Diff for: examples/feature_graph_backed_assets/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = True
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
deps =
@@ -20,4 +21,4 @@ allowlist_externals =
2021
uv
2122
commands =
2223
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
23-
pytest -c ../../pyproject.toml -vv
24+
pytest -vv

Diff for: examples/project_fully_featured/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ passenv =
1010
SNOWFLAKE_ACCOUNT
1111
SNOWFLAKE_USER
1212
SNOWFLAKE_PASSWORD
13+
PYTEST_ADDOPTS
1314
PYTEST_PLUGINS
1415
install_command = uv pip install -b ../../python_modules/libraries/dagster-pyspark/build-constraints {opts} {packages}
1516
deps =
@@ -31,4 +32,4 @@ allowlist_externals =
3132
uv
3233
commands =
3334
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
34-
pytest -c ../../pyproject.toml -vv
35+
pytest -vv

Diff for: examples/quickstart_aws/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
; version resolution issues prevent using uv
1112
; install_command = uv pip install {opts} {packages}
@@ -24,4 +25,4 @@ allowlist_externals =
2425
uv
2526
commands =
2627
source: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
27-
pytest -c ../../pyproject.toml -vv
28+
pytest -vv

Diff for: examples/quickstart_etl/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
; note: "source" does not work at this time due to dagster-cloud source access
@@ -21,4 +22,4 @@ allowlist_externals =
2122
uv
2223
commands =
2324
source: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
24-
pytest -c ../../pyproject.toml -vv
25+
pytest -vv

Diff for: examples/quickstart_gcp/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
; note: "source" does not work at this time due to dagster-cloud source access
@@ -24,4 +25,4 @@ allowlist_externals =
2425
uv
2526
commands =
2627
source: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
27-
pytest -c ../../pyproject.toml -vv
28+
pytest -vv

Diff for: examples/quickstart_snowflake/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ download = true
66
passenv =
77
CI_*
88
BUILDKITE*
9+
PYTEST_ADDOPTS
910
PYTEST_PLUGINS
1011
install_command = uv pip install {opts} {packages}
1112
; note: "source" does not work at this time due to dagster-cloud source access
@@ -25,4 +26,4 @@ allowlist_externals =
2526
uv
2627
commands =
2728
source: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
28-
pytest -c ../../pyproject.toml -vv
29+
pytest -vv

Diff for: examples/starlift-demo/tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ passenv =
77
CI_*
88
BUILDKITE*
99
KS_DBT_CLOUD*
10+
PYTEST_ADDOPTS
1011
PYTEST_PLUGINS
1112
install_command = uv pip install {opts} {packages}
1213
deps =
@@ -29,4 +30,4 @@ commands =
2930
# We need to rebuild the UI to ensure that the dagster-webserver can run
3031
make -C ../.. rebuild_ui
3132
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster'
32-
pytest -c ./pyproject.toml ./dbt_example_tests --snapshot-warn-unused -vv -s {posargs}
33+
pytest ./dbt_example_tests --snapshot-warn-unused -vv -s {posargs}

0 commit comments

Comments
 (0)