Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for xdist-grouping #9

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

satyasz
Copy link

@satyasz satyasz commented Jul 7, 2023

@christiansandberg
Please have a look.

While using marker @pytest.mark.xdist_group for a test as below and running with command --dist=loadgroup, report does not get generated.

Issue looks like:
nodeid comes as module::class::method**@group**
The one above in bold creates issue, and does not create report.

Script example:
tests\test_first.py

class TestA:
@pytest.mark.xdist_group("group1")
def test1():
pass

Run as:
pytest tests\test_first -n 1 --dist loadgroup

Attached error:
Xdist.grp.html.report.issue.txt

Copy link
Owner

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment on the changed lines explaining why this was needed in case someone wonders later on or someone would have issues.

@@ -134,7 +134,7 @@ def pytest_report_collectionfinish(self, config, items):
self.context["items"] = self._items

def pytest_runtest_logstart(self, nodeid):
testrun = self._get_testrun(nodeid)
testrun = self._get_testrun(nodeid.split('@', 1)[0])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the _get_testrun() method does not need to be modified if the input has already been processed?

Copy link
Author

@satyasz satyasz Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christiansandberg
If I don't change inside _get_testrun() method, its getting failed somewhere in Jinja2 lib.
I am new to Python, still analyzing why/where its failing.

If possible, Can you please help fixing this for the issue mentioned here,
christiansandberg/pytest-reporter-html1#16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christiansandberg - Can you please help on this.

@satyasz satyasz marked this pull request as draft August 4, 2023 19:05
@christiansandberg
Copy link
Owner

Could you try the latest master. I made a commit (a51474f) trying to fix it and a unit test for it, but I haven't tested it in a real environment.

@satyasz
Copy link
Author

satyasz commented Sep 21, 2023

Will test it.

@PRutkowski-tiplu
Copy link

Does this fix work and is there any chance to get it any time soon?

@christiansandberg
Copy link
Owner

If it doesn't work in the latest release then a new PR probably needs to be made.

@PRutkowski-tiplu
Copy link

Unfortunately I'm encountering this problem with the latest release of pytest-reporter-html1 (0.8.4), but it's super flaky. Sometimes it passes and sometimes fails with jinja2.exceptions.UndefinedError: 'None' has no attribute 'fspath'

@christiansandberg
Copy link
Owner

And you have the latest version of pytest-reporter also? Sometimes pip does not update dependencies automatically. But I wouldn't be surprised if there were more details regarding xdist that need to be taken into consideration. Unfortunately I don't use it myself so it doesn't get much testing in real life.

@PRutkowski-tiplu
Copy link

Yes, i also have the latest version of pytest-reporter (0.5.3) :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants