Skip to content

Pls help, Error: No moduled named xx is not a package #67

@distort5871

Description

@distort5871

Describe the bug
No moduled Named xx is not a package

To Reproduce
Steps to reproduce the behaviour:

  1. Use Pynguin version '3.10'
  2. Use the following (minimal) code as a subject for test generation:

import cacheops
from cacheops.utils import carefully_strip_whitespace

  1. Use the following command line arguments to Pynguin: pynguin --project-path ./django-cacheops/cacheops/templatetags --output-path ./pynguin-results --module-name cacheops'
  2. Give the error (stack trace, etc) you are encountering: '

│ C:\Users\x\AppData\Local\anaconda3\envs\ccpy10\lib\site-packages\pynguin\generator.py:163 in _load_sut │ │ │ │ 160 │ try: │ │ 161 │ │ # We need to set the current thread ident so the import trace is recorded. │ │ 162 │ │ tracer.current_thread_identifier = threading.current_thread().ident │ │ ❱ 163 │ │ importlib.import_module(config.configuration.module_name) │ │ 164 │ except ImportError as ex: │ │ 165 │ │ # A module could not be imported because some dependencies │ │ 166 │ │ # are missing or it is malformed │ │ │ │ C:\Users\x\AppData\Local\anaconda3\envs\ccpy10\lib\importlib\__init__.py:126 in import_module │ │ │ │ 123 │ │ │ if character != '.': │ │ 124 │ │ │ │ break │ │ 125 │ │ │ level += 1 │ │ ❱ 126 │ return _bootstrap._gcd_import(name[level:], package, level) │ │ 127 │ │ 128 │ │ 129 _RELOADING = {} │ │ in _gcd_import:1050 │ │ in _find_and_load:1027 │ │ in _find_and_load_unlocked:1006 │ │ in _load_unlocked:688 │ │ │ │ C:\Users\x\AppData\Local\anaconda3\envs\ccpy10\lib\site-packages\pynguin\instrumentation\machinery.py:59 in exec_module │ │ │ │ 56 │ │ │ 57 │ def exec_module(self, module): # noqa: D102 │ │ 58 │ │ self._tracer.reset() │ │ ❱ 59 │ │ super().exec_module(module) │ │ 60 │ │ self._tracer.store_import_trace() │ │ 61 │ │ │ 62 │ def get_code(self, fullname) -> CodeType: │ │ in exec_module:883 │ │ in _call_with_frames_removed:241 │ │ │ │ C:\Users\x\Documents\self\github.com\./django-cacheops/cacheops/templatetags\cacheops.py:8 in <module> │ │ │ │ 5 from django.template.library import TagHelperNode, parse_bits │ │ 6 │ │ 7 import cacheops │ │ ❱ 8 from cacheops.utils import carefully_strip_whitespace │ │ 9 │ │ 10 │ │ 11 __all__ = ['CacheopsLibrary', 'invalidate_fragment'] │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ModuleNotFoundError: No module named 'cacheops.utils'; 'cacheops' is not a package

Expected behavior
How to solve this problem?
Or what can i do to generate test case for this project:django-cacheops

Screenshots

  1. Errormsg
    errormsg

  2. Project
    project

Software Version (please complete the following information):

  • OS: Windows
  • Python version [3.10.14]
  • Pynguin Version [pynguin 0.36.0 pyhd8ed1ab_0 conda-forge]

Additional information:

  • I use this project to test if pynguin can generate test code for complicated project, maybe it will help you : django-cacheops

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions