diff --git a/.gitignore b/.gitignore index ed3fc535e..80db102b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.env +.idea/ .DS_Store .logfire .python-version diff --git a/Makefile b/Makefile index b2d1dd6bc..bb009fc40 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ typecheck: .PHONY: test # Run the tests test: - uv run --no-sync coverage run -m pytest + uv run --no-sync coverage run -m pytest -n auto --dist=loadgroup .PHONY: generate-stubs # Generate stubs for logfire-api generate-stubs: diff --git a/pyproject.toml b/pyproject.toml index 83733e097..1574e3a35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -165,6 +165,7 @@ dev = [ "boto3 >= 1.28.57", "botocore >= 1.31.57", "greenlet >= 3.1.1", + "pytest-xdist>=3.6.1", ] docs = [ "black>=23.12.0", diff --git a/tests/otel_integrations/test_celery.py b/tests/otel_integrations/test_celery.py index b076853d4..a2a77624c 100644 --- a/tests/otel_integrations/test_celery.py +++ b/tests/otel_integrations/test_celery.py @@ -61,6 +61,7 @@ def celery_worker(celery_app: Celery) -> Iterator[WorkController]: yield worker +@pytest.mark.xdist_group(name='sequential') def test_instrument_celery(celery_app: Celery, exporter: TestExporter) -> None: # Send and wait for the task to be executed result = celery_app.send_task('tasks.say_hello') # type: ignore diff --git a/tests/test_configure.py b/tests/test_configure.py index 6e2b7532e..7c9d8eebb 100644 --- a/tests/test_configure.py +++ b/tests/test_configure.py @@ -1037,6 +1037,7 @@ def test_initialize_project_not_confirming_organization(tmp_path: Path) -> None: ] +@pytest.mark.xdist_group(name='sequential') def test_initialize_project_create_project(tmp_dir_cwd: Path, tmp_path: Path, capsys: pytest.CaptureFixture[str]): auth_file = tmp_path / 'default.toml' auth_file.write_text( @@ -1161,6 +1162,7 @@ def test_initialize_project_create_project(tmp_dir_cwd: Path, tmp_path: Path, ca } +@pytest.mark.xdist_group(name='sequential') def test_initialize_project_create_project_default_organization(tmp_dir_cwd: Path, tmp_path: Path): auth_file = tmp_path / 'default.toml' auth_file.write_text( diff --git a/uv.lock b/uv.lock index 110f6c858..7dbe1183a 100644 --- a/uv.lock +++ b/uv.lock @@ -981,6 +981,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/02/cc/b7e31358aac6ed1ef2bb790a9746ac2c69bcb3c8588b41616914eb106eaf/exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", size = 16453 }, ] +[[package]] +name = "execnet" +version = "2.1.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bb/ff/b4c0dc78fbe20c3e59c0c7334de0c27eb4001a2b2017999af398bf730817/execnet-2.1.1.tar.gz", hash = "sha256:5189b52c6121c24feae288166ab41b32549c7e2348652736540b9e6e7d4e72e3", size = 166524 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/43/09/2aea36ff60d16dd8879bdb2f5b3ee0ba8d08cbbdcdfe870e695ce3784385/execnet-2.1.1-py3-none-any.whl", hash = "sha256:26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc", size = 40612 }, +] + [[package]] name = "executing" version = "2.1.0" @@ -1602,6 +1611,7 @@ dev = [ { name = "pytest-django" }, { name = "pytest-pretty" }, { name = "pytest-recording" }, + { name = "pytest-xdist" }, { name = "redis" }, { name = "requests" }, { name = "requests-mock" }, @@ -1727,6 +1737,7 @@ dev = [ { name = "pytest-django", specifier = ">=4.6.0" }, { name = "pytest-pretty", specifier = ">=1.2.0" }, { name = "pytest-recording", specifier = ">=0.13.2" }, + { name = "pytest-xdist", specifier = ">=3.6.1" }, { name = "redis", specifier = ">=5.1.1" }, { name = "requests", specifier = ">=2.31.0" }, { name = "requests-mock", specifier = ">=1.12.1" }, @@ -3713,6 +3724,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/72/52/8e67a969e9fad3fa5ec4eab9f2a7348ff04692065c7deda21d76e9112703/pytest_recording-0.13.2-py3-none-any.whl", hash = "sha256:3820fe5743d1ac46e807989e11d073cb776a60bdc544cf43ebca454051b22d13", size = 12783 }, ] +[[package]] +name = "pytest-xdist" +version = "3.6.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "execnet" }, + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/41/c4/3c310a19bc1f1e9ef50075582652673ef2bfc8cd62afef9585683821902f/pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d", size = 84060 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6d/82/1d96bf03ee4c0fdc3c0cbe61470070e659ca78dc0086fb88b66c185e2449/pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7", size = 46108 }, +] + [[package]] name = "python-dateutil" version = "2.9.0.post0"