Skip to content

Commit ca37cb5

Browse files
Add consider_namespace_packages=False (ros2#766) (ros2#777)
* Add consider_namespace_packages=False Signed-off-by: Tony Najjar <[email protected]> (cherry picked from commit 07f4332) Co-authored-by: Tony Najjar <[email protected]>
1 parent 698e979 commit ca37cb5

File tree

1 file changed

+8
-3
lines changed
  • launch_testing/launch_testing/pytest

1 file changed

+8
-3
lines changed

launch_testing/launch_testing/pytest/hooks.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ def makeitem(self, *args, **kwargs):
157157
return LaunchTestItem.from_parent(*args, **kwargs)
158158

159159
def collect(self):
160-
if _pytest_version_ge(7):
161-
# self.path exists since 7
160+
if _pytest_version_ge(8, 1, 0):
161+
from _pytest.pathlib import import_path
162+
module = import_path(self.path, root=None, consider_namespace_packages=False)
163+
elif _pytest_version_ge(7, 0, 0):
162164
from _pytest.pathlib import import_path
163165
module = import_path(self.path, root=None)
164166
else:
@@ -173,7 +175,10 @@ def collect(self):
173175

174176
def find_launch_test_entrypoint(path):
175177
try:
176-
if _pytest_version_ge(7):
178+
if _pytest_version_ge(8, 1, 0):
179+
from _pytest.pathlib import import_path
180+
module = import_path(path, root=None, consider_namespace_packages=False)
181+
elif _pytest_version_ge(7, 0, 0):
177182
from _pytest.pathlib import import_path
178183
module = import_path(path, root=None)
179184
else:

0 commit comments

Comments
 (0)