Skip to content

Commit

Permalink
Start using xdist in pytest opts
Browse files Browse the repository at this point in the history
We have `pytest-xdist` already installed, but we aren't using it.

Set `-n auto --maxprocesses 8` in our config, so that it will be
activated. The max prevents `-n auto` from starting large numbers of
workers (e.g., 20) and losing any speed benefit to overheads. Using
`-n auto` rather than (e.g., `-n 4`) ensures that in CI and other
variable environments, we get the right number of workers.

One test with a randomized parameter needed a tweak, as it made an
xdist parameter consistency check fail.
  • Loading branch information
sirosen committed Jan 13, 2025
1 parent ab0db21 commit 11ec517
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ attr = "globus_cli.version.__version__"
profile = "black"

[tool.pytest.ini_options]
addopts = "--timeout 3 --color=yes"
addopts = "-n auto --maxprocesses 8 --timeout 3 --color=yes"
filterwarnings = ["error"]

[tool.scriv]
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/gcs/endpoint/test_set_subscription_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from globus_sdk._testing import load_response_set


@pytest.mark.parametrize("subscription_id", (str(uuid.uuid4()), "DEFAULT", "null"))
@pytest.mark.parametrize(
"subscription_id", (str(uuid.UUID(int=101)), "DEFAULT", "null")
)
def test_gcs_endpoint_set_subscription_id(subscription_id, run_line, add_gcs_login):
meta = load_response_set("cli.collection_operations").metadata
endpoint_id = meta["endpoint_id"]
Expand Down

0 comments on commit 11ec517

Please sign in to comment.