Closed ravindrabajpai closed 8 months ago
Hi,
Could you please provide a minimal working example that shows this behaviour, together with the used software versions and Pynguin command line you've used?
Best, Stephan
Hi Stephan,
Thank you for your response. Please find the minimal repro below -
which python /work/venvs/py310/bin/python
python --version Python 3.10.6
pynguin --version pynguin 0.27.0
pwd /work/test/repro
cd /work/test/repro
ls pycache mydb.db pynguin-report pynguine_tests ut
cat ut/test_main.py `import sys from typing import List
import sqlalchemy from sqlalchemy.orm import sessionmaker
class SQLiteConnectionManager(object): def init(self): super().init()
@staticmethod
def get_connection_for_env():
engine = sqlalchemy.create_engine("sqlite:////work/test/repro")
session_maker = sessionmaker(bind=engine)
session = session_maker()
return engine, session
if name == 'main': try: engine, session = SQLiteConnectionManager.get_connection_for_env() print ('Connection Initialized...') sys.exit(0) except Exception as e: print (e) raise e finally: print('Finally closing db connection') session.close() engine.dispose() ` python ut/test_main.py Connection Initialized... Finally closing db connection
pynguin --project-path /work/test/repro/ut --output-path /work/test/repro/pynguine_tests/ --module-name test_main
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /work/venvs/py310/bin/pynguin:8 in
Hi,
In my project, I am using dependencies such as sqlalchemy, boto3, and pynguin reports an error as -
│ /work/venvs/py310/lib/python3.10/site-packages/sqlalchemy/orm/decl_api.py:309 in cascading │ │ │ │ 306 │ │ │ │ 307 │ │ │ │ 308 │ │ """ │ │ ❱ 309 │ │ return cls._stateful(cascading=True) │ │ 310 │ │ 311 │ │ 312 class _stateful_declared_attr(declared_attr): │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: _stateful_declared_attr._stateful() missing 1 required positional argument: 'self'
My project runs fine although.
Is there a way to make penguin avoid looking deeper into the code, which I have not written such as these.
What is the guidelines to ignore these dependencies, shall we mock them from our side before running penguin. Please guide.
Thanks.