Skip to content

Commit

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

Signed-off-by: Tony Najjar <[email protected]>
(cherry picked from commit 07f4332)

Co-authored-by: Tony Najjar <[email protected]>
  • Loading branch information
mergify[bot] and tonynajjar authored May 16, 2024
1 parent 698e979 commit ca37cb5
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 ca37cb5

Please sign in to comment.