pytest-dev / pytest-dev/pytest-xdist

Workers did not share option from controller

Open
#800 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

starting pytest-xdist==1.30.0(Oct 1, 2019) config.option may not be shared between controller and worker processes

sample

pytest.ini

[pytest]
base_url = http://testurl
addopts=-n 1

test_base_url.py

def test_base_url(base_url):
    assert base_url == 'http://testurl'

this assert fail when run on xdist workers

[gw0] Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
gw0 [1]

scheduling tests via LoadScheduling

test_base_url.py::test_base_url 
[gw0] [100%] FAILED test_base_url.py::test_base_url 
test_base_url.py:2 (test_base_url)
base_url = None, request = <FixtureRequest for <Function test_base_url>>

    def test_base_url(base_url, request):
>       assert base_url == 'http://testurl'
E       AssertionError: assert None == 'http://testurl'

test_base_url.py:4: AssertionError


============================== 1 failed in 0.55s ==============================

and pass when run without it
pytest.ini

[pytest]
base_url = http://testurl
============================= test session starts =============================
collecting ... collected 1 item

test_base_url.py::test_base_url PASSED                                   [100%]

============================== 1 passed in 0.01s ==============================

pytest-xdist==2.5.0
pytest-base-url==2.0.0
pytest==7.1.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with pytest.ini setting base_url and addopts=-n 1, using test_base_url.py and the reported pytest-xdist, pytest-base-url, and pytest versions. Compare the worker run with the serial run; done means the worker receives the configured base_url and the test passes under xdist.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.