Skip to content

Commit

Permalink
Add consider_namespace_packages=False (#766)
Browse files Browse the repository at this point in the history
* Add consider_namespace_packages=False

Signed-off-by: Tony Najjar <[email protected]>
  • Loading branch information
tonynajjar authored Mar 13, 2024
1 parent d9ffd80 commit 07f4332
Showing 1 changed file with 8 additions and 3 deletions.
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)
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

0 comments on commit 07f4332

Please sign in to comment.