Skip to content

Fix bug in db fixture#2089

Open
tobiaskleiner wants to merge 5 commits intomainfrom
Fix-bug-in-db-fixture-setup
Open

Fix bug in db fixture#2089
tobiaskleiner wants to merge 5 commits intomainfrom
Fix-bug-in-db-fixture-setup

Conversation

@tobiaskleiner
Copy link
Copy Markdown
Collaborator

No description provided.

@ctao-sonarqube
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@GernotMaier GernotMaier left a comment

Choose a reason for hiding this comment

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

You want to fix the SonarQ and Copilot comments?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment on lines +43 to +46
return False
parts = tuple(path.parts)
db_parts = ("tests", "unit_tests", "db")
return any(parts[idx : idx + 3] == db_parts for idx in range(max(len(parts) - 2, 0)))
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

pytest_collection_modifyitems relies on item.path, but the rest of this conftest (and older pytest versions) use request.node.fspath. If item.path isn’t present (e.g., pytest versions that only expose fspath), db tests won’t be auto-marked and fixture routing can regress. Consider falling back to item.fspath (convert to Path(str(...))) when item.path is missing.

Suggested change
return False
parts = tuple(path.parts)
db_parts = ("tests", "unit_tests", "db")
return any(parts[idx : idx + 3] == db_parts for idx in range(max(len(parts) - 2, 0)))
fspath = getattr(item, "fspath", None)
if fspath is None:
return False
path = Path(str(fspath))
parts = tuple(path.parts)
db_parts = ("tests", "unit_tests", "db")
return any(
parts[idx : idx + 3] == db_parts for idx in range(max(len(parts) - 2, 0))
)

Copilot uses AI. Check for mistakes.
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.

3 participants