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

Add consider_namespace_packages=False #766

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions launch_testing/launch_testing/pytest/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ def makeitem(self, *args, **kwargs):
return LaunchTestItem.from_parent(*args, **kwargs)

def collect(self):
if _pytest_version_ge(7):
# self.path exists since 7
if _pytest_version_ge(8, 1, 0):
from _pytest.pathlib import import_path
module = import_path(self.path, root=None, consider_namespace_packages=False)
clalancette marked this conversation as resolved.
Show resolved Hide resolved
elif _pytest_version_ge(7, 0, 0):
from _pytest.pathlib import import_path
module = import_path(self.path, root=None)
else:
Expand All @@ -173,7 +175,10 @@ def collect(self):

def find_launch_test_entrypoint(path):
try:
if _pytest_version_ge(7):
if _pytest_version_ge(8, 1, 0):
from _pytest.pathlib import import_path
module = import_path(path, root=None, consider_namespace_packages=False)
elif _pytest_version_ge(7, 0, 0):
from _pytest.pathlib import import_path
module = import_path(path, root=None)
else:
Expand Down