fix: handle missing chunks_per_batch attribute in cognify CLI command
Fix AttributeError when args.chunks_per_batch is not present in the argparse.Namespace object. Use getattr() with default value of None to safely access the optional chunks_per_batch parameter. This resolves test failures in test_cli_edge_cases.py where Namespace objects were created without the chunks_per_batch attribute. Changes: - Use getattr(args, 'chunks_per_batch', None) instead of direct access - Update test assertion to expect chunks_per_batch=None parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f2166be823
commit
e38c33c1b5
2 changed files with 2 additions and 1 deletions
|
|
@ -116,7 +116,7 @@ After successful cognify processing, use `cognee search` to query the knowledge
|
||||||
chunk_size=args.chunk_size,
|
chunk_size=args.chunk_size,
|
||||||
ontology_file_path=args.ontology_file,
|
ontology_file_path=args.ontology_file,
|
||||||
run_in_background=args.background,
|
run_in_background=args.background,
|
||||||
chunks_per_batch=args.chunks_per_batch,
|
chunks_per_batch=getattr(args, 'chunks_per_batch', None),
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -373,6 +373,7 @@ class TestCognifyCommandEdgeCases:
|
||||||
ontology_file_path=None,
|
ontology_file_path=None,
|
||||||
chunker=TextChunker,
|
chunker=TextChunker,
|
||||||
run_in_background=False,
|
run_in_background=False,
|
||||||
|
chunks_per_batch=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue