codegraphcontext 0.1.37__tar.gz → 0.1.38__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {codegraphcontext-0.1.37/src/codegraphcontext.egg-info → codegraphcontext-0.1.38}/PKG-INFO +4 -23
  2. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/README.md +3 -22
  3. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/pyproject.toml +11 -1
  4. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38/src/codegraphcontext.egg-info}/PKG-INFO +4 -23
  5. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext.egg-info/SOURCES.txt +1 -11
  6. codegraphcontext-0.1.37/tests/test_cpp_parser.py +0 -171
  7. codegraphcontext-0.1.37/tests/test_database_validation.py +0 -221
  8. codegraphcontext-0.1.37/tests/test_end_to_end.py +0 -195
  9. codegraphcontext-0.1.37/tests/test_graph_indexing.py +0 -487
  10. codegraphcontext-0.1.37/tests/test_graph_indexing_js.py +0 -115
  11. codegraphcontext-0.1.37/tests/test_kotlin_parser.py +0 -97
  12. codegraphcontext-0.1.37/tests/test_swift_parser.py +0 -157
  13. codegraphcontext-0.1.37/tests/test_tree_sitter_manager.py +0 -241
  14. codegraphcontext-0.1.37/tests/test_typescript_parser.py +0 -60
  15. codegraphcontext-0.1.37/tests/test_visualization.py +0 -548
  16. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/LICENSE +0 -0
  17. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/MANIFEST.in +0 -0
  18. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/setup.cfg +0 -0
  19. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/__init__.py +0 -0
  20. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/__main__.py +0 -0
  21. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/__init__.py +0 -0
  22. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/cli_helpers.py +0 -0
  23. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/config_manager.py +0 -0
  24. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/main.py +0 -0
  25. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/registry_commands.py +0 -0
  26. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/setup_macos.py +0 -0
  27. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/setup_wizard.py +0 -0
  28. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/cli/visualizer.py +0 -0
  29. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/__init__.py +0 -0
  30. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/cgc_bundle.py +0 -0
  31. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/database.py +0 -0
  32. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/database_falkordb.py +0 -0
  33. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/falkor_worker.py +0 -0
  34. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/jobs.py +0 -0
  35. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/core/watcher.py +0 -0
  36. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/prompts.py +0 -0
  37. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/server.py +0 -0
  38. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tool_definitions.py +0 -0
  39. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/__init__.py +0 -0
  40. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
  41. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/code_finder.py +0 -0
  42. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/graph_builder.py +0 -0
  43. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/handlers/analysis_handlers.py +0 -0
  44. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/handlers/indexing_handlers.py +0 -0
  45. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/handlers/management_handlers.py +0 -0
  46. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/handlers/query_handlers.py +0 -0
  47. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/handlers/watcher_handlers.py +0 -0
  48. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/c.py +0 -0
  49. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/cpp.py +0 -0
  50. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/csharp.py +0 -0
  51. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/go.py +0 -0
  52. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/haskell.py +0 -0
  53. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/java.py +0 -0
  54. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/javascript.py +0 -0
  55. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/kotlin.py +0 -0
  56. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/php.py +0 -0
  57. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/python.py +0 -0
  58. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/ruby.py +0 -0
  59. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/rust.py +0 -0
  60. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/scala.py +0 -0
  61. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/swift.py +0 -0
  62. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/typescript.py +0 -0
  63. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/languages/typescriptjsx.py +0 -0
  64. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/package_resolver.py +0 -0
  65. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
  66. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +0 -0
  67. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
  68. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
  69. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/haskell_toolkit.py +0 -0
  70. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
  71. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
  72. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
  73. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
  74. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
  75. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/scala_toolkit.py +0 -0
  76. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/swift_toolkit.py +0 -0
  77. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
  78. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/tools/system.py +0 -0
  79. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/utils/debug_log.py +0 -0
  80. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/utils/tree_sitter_manager.py +0 -0
  81. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext/utils/visualize_graph.py +0 -0
  82. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext.egg-info/dependency_links.txt +0 -0
  83. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext.egg-info/entry_points.txt +0 -0
  84. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext.egg-info/requires.txt +0 -0
  85. {codegraphcontext-0.1.37 → codegraphcontext-0.1.38}/src/codegraphcontext.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphcontext
3
- Version: 0.1.37
3
+ Version: 0.1.38
4
4
  Summary: An MCP server that indexes local code into a graph database to provide context to AI assistants.
5
5
  Author-email: Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
6
6
  License: MIT License
@@ -76,8 +76,8 @@ Dynamic: license-file
76
76
  <img src="https://img.shields.io/github/license/CodeGraphContext/CodeGraphContext?style=flat-square" alt="License">
77
77
  </a>
78
78
  <img src="https://img.shields.io/badge/MCP-Compatible-green?style=flat-square" alt="MCP Compatible">
79
- <a href="https://discord.gg/dR4QY32uYQ">
80
- <img src="https://img.shields.io/discord/dR4QY32uYQ?style=flat-square&logo=discord" alt="Discord">
79
+ <a href="https://discord.gg/VCwUdCnn">
80
+ <img src="https://img.shields.io/discord/VCwUdCnn?style=flat-square&logo=discord" alt="Discord">
81
81
  </a>
82
82
  <br><br>
83
83
  <a href="https://github.com/CodeGraphContext/CodeGraphContext/stargazers">
@@ -139,7 +139,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
139
139
  ---
140
140
 
141
141
  ## Project Details
142
- - **Version:** 0.1.37
142
+ - **Version:** 0.1.38
143
143
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
144
144
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
145
145
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -419,25 +419,6 @@ Add the following server configuration to your client's settings file (e.g., VS
419
419
  "NEO4J_USERNAME": "YOUR_NEO4J_USERNAME",
420
420
  "NEO4J_PASSWORD": "YOUR_NEO4J_PASSWORD"
421
421
  },
422
- "tools": {
423
- "alwaysAllow": [
424
- "add_code_to_graph",
425
- "add_package_to_graph",
426
- "check_job_status",
427
- "list_jobs",
428
- "find_code",
429
- "analyze_code_relationships",
430
- "watch_directory",
431
- "find_dead_code",
432
- "execute_cypher_query",
433
- "calculate_cyclomatic_complexity",
434
- "find_most_complex_functions",
435
- "list_indexed_repositories",
436
- "delete_repository",
437
- "visualize_graph_query",
438
- "list_watched_paths",
439
- "unwatch_directory"
440
- ],
441
422
  "disabled": false
442
423
  },
443
424
  "disabled": false,
@@ -14,8 +14,8 @@
14
14
  <img src="https://img.shields.io/github/license/CodeGraphContext/CodeGraphContext?style=flat-square" alt="License">
15
15
  </a>
16
16
  <img src="https://img.shields.io/badge/MCP-Compatible-green?style=flat-square" alt="MCP Compatible">
17
- <a href="https://discord.gg/dR4QY32uYQ">
18
- <img src="https://img.shields.io/discord/dR4QY32uYQ?style=flat-square&logo=discord" alt="Discord">
17
+ <a href="https://discord.gg/VCwUdCnn">
18
+ <img src="https://img.shields.io/discord/VCwUdCnn?style=flat-square&logo=discord" alt="Discord">
19
19
  </a>
20
20
  <br><br>
21
21
  <a href="https://github.com/CodeGraphContext/CodeGraphContext/stargazers">
@@ -77,7 +77,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
77
77
  ---
78
78
 
79
79
  ## Project Details
80
- - **Version:** 0.1.37
80
+ - **Version:** 0.1.38
81
81
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
82
82
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
83
83
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -357,25 +357,6 @@ Add the following server configuration to your client's settings file (e.g., VS
357
357
  "NEO4J_USERNAME": "YOUR_NEO4J_USERNAME",
358
358
  "NEO4J_PASSWORD": "YOUR_NEO4J_PASSWORD"
359
359
  },
360
- "tools": {
361
- "alwaysAllow": [
362
- "add_code_to_graph",
363
- "add_package_to_graph",
364
- "check_job_status",
365
- "list_jobs",
366
- "find_code",
367
- "analyze_code_relationships",
368
- "watch_directory",
369
- "find_dead_code",
370
- "execute_cypher_query",
371
- "calculate_cyclomatic_complexity",
372
- "find_most_complex_functions",
373
- "list_indexed_repositories",
374
- "delete_repository",
375
- "visualize_graph_query",
376
- "list_watched_paths",
377
- "unwatch_directory"
378
- ],
379
360
  "disabled": false
380
361
  },
381
362
  "disabled": false,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codegraphcontext"
3
- version = "0.1.37"
3
+ version = "0.1.38"
4
4
  description = "An MCP server that indexes local code into a graph database to provide context to AI assistants."
5
5
  authors = [{ name = "Shashank Shekhar Singh", email = "shashankshekharsingh1205@gmail.com" }]
6
6
  readme = "README.md"
@@ -57,3 +57,13 @@ package-dir = { "" = "src" }
57
57
  [tool.setuptools.packages.find]
58
58
  where = ["src"]
59
59
  include = ["codegraphcontext*"]
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests"]
63
+ python_files = ["test_*.py"]
64
+ norecursedirs = ["tests/fixtures", "tests/e2e/sample_projects", "venv", ".git", "__pycache__"]
65
+ markers = [
66
+ "integration: mark a test as an integration test.",
67
+ "e2e: mark a test as an end-to-end test.",
68
+ "slow: mark test as slow."
69
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphcontext
3
- Version: 0.1.37
3
+ Version: 0.1.38
4
4
  Summary: An MCP server that indexes local code into a graph database to provide context to AI assistants.
5
5
  Author-email: Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
6
6
  License: MIT License
@@ -76,8 +76,8 @@ Dynamic: license-file
76
76
  <img src="https://img.shields.io/github/license/CodeGraphContext/CodeGraphContext?style=flat-square" alt="License">
77
77
  </a>
78
78
  <img src="https://img.shields.io/badge/MCP-Compatible-green?style=flat-square" alt="MCP Compatible">
79
- <a href="https://discord.gg/dR4QY32uYQ">
80
- <img src="https://img.shields.io/discord/dR4QY32uYQ?style=flat-square&logo=discord" alt="Discord">
79
+ <a href="https://discord.gg/VCwUdCnn">
80
+ <img src="https://img.shields.io/discord/VCwUdCnn?style=flat-square&logo=discord" alt="Discord">
81
81
  </a>
82
82
  <br><br>
83
83
  <a href="https://github.com/CodeGraphContext/CodeGraphContext/stargazers">
@@ -139,7 +139,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
139
139
  ---
140
140
 
141
141
  ## Project Details
142
- - **Version:** 0.1.37
142
+ - **Version:** 0.1.38
143
143
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
144
144
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
145
145
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -419,25 +419,6 @@ Add the following server configuration to your client's settings file (e.g., VS
419
419
  "NEO4J_USERNAME": "YOUR_NEO4J_USERNAME",
420
420
  "NEO4J_PASSWORD": "YOUR_NEO4J_PASSWORD"
421
421
  },
422
- "tools": {
423
- "alwaysAllow": [
424
- "add_code_to_graph",
425
- "add_package_to_graph",
426
- "check_job_status",
427
- "list_jobs",
428
- "find_code",
429
- "analyze_code_relationships",
430
- "watch_directory",
431
- "find_dead_code",
432
- "execute_cypher_query",
433
- "calculate_cyclomatic_complexity",
434
- "find_most_complex_functions",
435
- "list_indexed_repositories",
436
- "delete_repository",
437
- "visualize_graph_query",
438
- "list_watched_paths",
439
- "unwatch_directory"
440
- ],
441
422
  "disabled": false
442
423
  },
443
424
  "disabled": false,
@@ -70,14 +70,4 @@ src/codegraphcontext/tools/query_tool_languages/swift_toolkit.py
70
70
  src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py
71
71
  src/codegraphcontext/utils/debug_log.py
72
72
  src/codegraphcontext/utils/tree_sitter_manager.py
73
- src/codegraphcontext/utils/visualize_graph.py
74
- tests/test_cpp_parser.py
75
- tests/test_database_validation.py
76
- tests/test_end_to_end.py
77
- tests/test_graph_indexing.py
78
- tests/test_graph_indexing_js.py
79
- tests/test_kotlin_parser.py
80
- tests/test_swift_parser.py
81
- tests/test_tree_sitter_manager.py
82
- tests/test_typescript_parser.py
83
- tests/test_visualization.py
73
+ src/codegraphcontext/utils/visualize_graph.py
@@ -1,171 +0,0 @@
1
- """
2
- Test script for the enhanced C++ parser.
3
- """
4
- import json
5
- import sys
6
- from pathlib import Path
7
-
8
-
9
- def test_parser():
10
- """Test the C++ parser with a sample file."""
11
- test_cpp_code = '''
12
-
13
- class TestClass : public BaseClass {
14
- private:
15
- int privateVar;
16
- std::string name;
17
-
18
- protected:
19
- double protectedVar;
20
-
21
- public:
22
- /**
23
- * Constructor for TestClass
24
- * @param value Initial value
25
- */
26
- TestClass(int value) : privateVar(value) {}
27
-
28
- /// Gets the private variable value
29
- int getValue() const {
30
- return privateVar;
31
- }
32
-
33
- /**
34
- * Complex method with parameters
35
- */
36
- virtual void complexMethod(int x, const std::string& str, double y = 3.14) override {
37
- if (x > 0) {
38
- for (int i = 0; i < x; i++) {
39
- processData(i);
40
- }
41
- }
42
- }
43
- };
44
-
45
- namespace MyNamespace {
46
- enum Color {
47
- RED,
48
- GREEN,
49
- BLUE
50
- };
51
-
52
- /**
53
- * Standalone function
54
- */
55
- static inline int calculate(int a, int b) {
56
- return a + b;
57
- }
58
- }
59
-
60
- // Global variable
61
- int globalCounter = 0;
62
-
63
- #include <iostream>
64
- #include <string>
65
- #include "custom_header.h"
66
- '''
67
- test_file = Path("test_sample.cpp")
68
- test_file.write_text(test_cpp_code)
69
-
70
- print("=" * 60)
71
- print("Testing Enhanced C++ Parser")
72
- print("=" * 60)
73
-
74
- try:
75
- from tree_sitter import Language, Parser
76
- import tree_sitter_cpp as tscpp
77
- class MockGenericParser:
78
- def __init__(self):
79
- self.language = Language(tscpp.language())
80
- self.parser = Parser(self.language)
81
- from cpp_parser_enhanced import CppTreeSitterParser
82
-
83
- generic_wrapper = MockGenericParser()
84
- cpp_parser = CppTreeSitterParser(generic_wrapper)
85
-
86
- print(f"\n Parsing: {test_file}")
87
- result = cpp_parser.parse(test_file)
88
-
89
- print("\n" + "=" * 60)
90
- print("PARSING RESULTS")
91
- print("=" * 60)
92
-
93
- print(f"\n File: {result['file_path']}")
94
- print(f" Language: {result['lang']}")
95
-
96
- print(f"\n Functions Found: {len(result['functions'])}")
97
- for func in result['functions']:
98
- print(f"\n Function: {func['name']}")
99
- print(f" Lines: {func['line_number']}-{func['end_line']}")
100
- print(f" Return Type: {func['return_type']}")
101
- print(f" Parameters: {len(func['args'])}")
102
- for param in func['args']:
103
- default = f" = {param['default']}" if param['default'] else ""
104
- print(f" - {param['type']} {param['name']}{default}")
105
- print(f" Modifiers: {', '.join(func['modifiers']) if func['modifiers'] else 'None'}")
106
- print(f" Complexity: {func['complexity']}")
107
- print(f" Calls: {[c['name'] for c in func['calls']]}")
108
- if func['docstring']:
109
- print(f" Docstring: {func['docstring'][:50]}...")
110
-
111
-
112
- print(f"\n Classes Found: {len(result['classes'])}")
113
- for cls in result['classes']:
114
- print(f"\n Class: {cls['name']}")
115
- print(f" Lines: {cls['line_number']}-{cls['end_line']}")
116
- print(f" Base Classes: {cls['bases']}")
117
- print(f" Template: {cls['is_template']}")
118
- print(f" Methods: {len(cls['methods'])}")
119
- for method in cls['methods']:
120
- print(f" - {method['access']}: {method['return_type']} {method['name']}()")
121
- print(f" Members: {len(cls['members'])}")
122
- for member in cls['members']:
123
- print(f" - {member['access']}: {member['type']} {member['name']}")
124
- if cls['docstring']:
125
- print(f" Docstring: {cls['docstring'][:50]}...")
126
-
127
- print(f"\n Namespaces Found: {len(result['namespaces'])}")
128
- for ns in result['namespaces']:
129
- print(f" - {ns['name']} (lines {ns['line_number']}-{ns['end_line']})")
130
-
131
- print(f"\n Enums Found: {len(result['enums'])}")
132
- for enum in result['enums']:
133
- print(f" - {enum['name']}: {enum['values']}")
134
-
135
- print(f"\n Global Variables: {len(result['variables'])}")
136
- for var in result['variables']:
137
- print(f" - {var['type']} {var['name']} (line {var['line_number']})")
138
-
139
- print(f"\n Imports Found: {len(result['imports'])}")
140
- for imp in result['imports']:
141
- import_type = "system" if imp.get('is_system') else "local"
142
- print(f" - {imp['name']} ({import_type})")
143
-
144
- print(f"\n Function Calls: {len(result['function_calls'])}")
145
- for call in result['function_calls'][:10]:
146
- print(f" - {call['name']} (line {call['line_number']})")
147
-
148
- output_file = Path("test_result.json")
149
- with open(output_file, 'w') as f:
150
- json.dump(result, f, indent=2)
151
-
152
- print(f"\n Full results saved to: {output_file}")
153
- print("\n" + "=" * 60)
154
- print("TEST COMPLETED SUCCESSFULLY!")
155
- print("=" * 60)
156
- assert True
157
-
158
- except Exception as e:
159
- print(f"\n ERROR: {e}")
160
- import traceback
161
- traceback.print_exc()
162
- assert True
163
-
164
- finally:
165
- if test_file.exists():
166
- test_file.unlink()
167
- print(f"\n cleaned up test file")
168
-
169
- if __name__ == "__main__":
170
- success = test_parser()
171
- sys.exit(0 if success else 1)
@@ -1,221 +0,0 @@
1
- """
2
- Tests for database configuration validation and error handling.
3
- """
4
-
5
- import pytest
6
- import sys
7
- from pathlib import Path
8
-
9
- # Add src to path for imports (needed for direct test execution)
10
- sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
11
-
12
- from codegraphcontext.core.database import DatabaseManager
13
-
14
-
15
- class TestConfigValidation:
16
- """Tests for validate_config method"""
17
-
18
- def test_validate_config_valid_neo4j_uri(self):
19
- """Test validation passes for valid neo4j:// URI"""
20
- is_valid, error = DatabaseManager.validate_config(
21
- "neo4j://localhost:7687", "neo4j", "password123"
22
- )
23
- assert is_valid is True
24
- assert error is None
25
-
26
- def test_validate_config_valid_bolt_uri(self):
27
- """Test validation passes for valid bolt:// URI"""
28
- is_valid, error = DatabaseManager.validate_config(
29
- "bolt://localhost:7687", "neo4j", "password123"
30
- )
31
- assert is_valid is True
32
- assert error is None
33
-
34
- def test_validate_config_valid_secure_uri(self):
35
- """Test validation passes for valid neo4j+s:// URI"""
36
- is_valid, error = DatabaseManager.validate_config(
37
- "neo4j+s://localhost:7687", "neo4j", "password123"
38
- )
39
- assert is_valid is True
40
- assert error is None
41
-
42
- def test_validate_config_invalid_uri_no_protocol(self):
43
- """Test validation fails for URI without protocol"""
44
- is_valid, error = DatabaseManager.validate_config(
45
- "localhost:7687", "neo4j", "password123"
46
- )
47
- assert is_valid is False
48
- assert error is not None
49
- assert "Invalid Neo4j URI format" in error
50
- assert "neo4j://" in error or "bolt://" in error
51
-
52
- def test_validate_config_invalid_uri_no_port(self):
53
- """Test validation fails for URI without port"""
54
- is_valid, error = DatabaseManager.validate_config(
55
- "neo4j://localhost", "neo4j", "password123"
56
- )
57
- assert is_valid is False
58
- assert error is not None
59
- assert "Invalid Neo4j URI format" in error
60
-
61
- def test_validate_config_invalid_uri_wrong_protocol(self):
62
- """Test validation fails for invalid protocol"""
63
- is_valid, error = DatabaseManager.validate_config(
64
- "http://localhost:7687", "neo4j", "password123"
65
- )
66
- assert is_valid is False
67
- assert error is not None
68
- assert "Invalid Neo4j URI format" in error
69
-
70
- def test_validate_config_empty_username(self):
71
- """Test validation fails for empty username"""
72
- is_valid, error = DatabaseManager.validate_config(
73
- "neo4j://localhost:7687", "", "password123"
74
- )
75
- assert is_valid is False
76
- assert error is not None
77
- assert "Username cannot be empty" in error
78
- assert "neo4j" in error # Should mention default username
79
-
80
- def test_validate_config_whitespace_username(self):
81
- """Test validation fails for whitespace-only username"""
82
- is_valid, error = DatabaseManager.validate_config(
83
- "neo4j://localhost:7687", " ", "password123"
84
- )
85
- assert is_valid is False
86
- assert error is not None
87
- assert "Username cannot be empty" in error
88
-
89
- def test_validate_config_none_username(self):
90
- """Test validation fails for None username"""
91
- is_valid, error = DatabaseManager.validate_config(
92
- "neo4j://localhost:7687", None, "password123"
93
- )
94
- assert is_valid is False
95
- assert error is not None
96
- assert "Username cannot be empty" in error
97
-
98
- def test_validate_config_empty_password(self):
99
- """Test validation fails for empty password"""
100
- is_valid, error = DatabaseManager.validate_config(
101
- "neo4j://localhost:7687", "neo4j", ""
102
- )
103
- assert is_valid is False
104
- assert error is not None
105
- assert "Password cannot be empty" in error
106
-
107
- def test_validate_config_whitespace_password(self):
108
- """Test validation fails for whitespace-only password"""
109
- is_valid, error = DatabaseManager.validate_config(
110
- "neo4j://localhost:7687", "neo4j", " "
111
- )
112
- assert is_valid is False
113
- assert error is not None
114
- assert "Password cannot be empty" in error
115
-
116
- def test_validate_config_none_password(self):
117
- """Test validation fails for None password"""
118
- is_valid, error = DatabaseManager.validate_config(
119
- "neo4j://localhost:7687", "neo4j", None
120
- )
121
- assert is_valid is False
122
- assert error is not None
123
- assert "Password cannot be empty" in error
124
-
125
- def test_validate_config_valid_with_special_chars_in_password(self):
126
- """Test validation passes for password with special characters"""
127
- is_valid, error = DatabaseManager.validate_config(
128
- "neo4j://localhost:7687", "neo4j", "p@ssw0rd!#$%"
129
- )
130
- assert is_valid is True
131
- assert error is None
132
-
133
- def test_validate_config_valid_custom_port(self):
134
- """Test validation passes for custom port"""
135
- is_valid, error = DatabaseManager.validate_config(
136
- "neo4j://localhost:7688", "neo4j", "password123"
137
- )
138
- assert is_valid is True
139
- assert error is None
140
-
141
- def test_validate_config_valid_remote_host(self):
142
- """Test validation passes for remote host"""
143
- is_valid, error = DatabaseManager.validate_config(
144
- "neo4j://example.com:7687", "neo4j", "password123"
145
- )
146
- assert is_valid is True
147
- assert error is None
148
-
149
- def test_validate_config_valid_ip_address(self):
150
- """Test validation passes for IP address"""
151
- is_valid, error = DatabaseManager.validate_config(
152
- "neo4j://192.168.1.100:7687", "neo4j", "password123"
153
- )
154
- assert is_valid is True
155
- assert error is None
156
-
157
-
158
- class TestConnectionTest:
159
- """Tests for test_connection method"""
160
-
161
- def test_connection_invalid_host_unreachable(self):
162
- """Test connection fails gracefully for unreachable host"""
163
- is_connected, error = DatabaseManager.test_connection(
164
- "neo4j://unreachable-host-12345.invalid:7687", "neo4j", "password123"
165
- )
166
- assert is_connected is False
167
- assert error is not None
168
- assert "Cannot reach Neo4j server" in error or "Connection failed" in error
169
-
170
- def test_connection_invalid_port(self):
171
- """Test connection fails for invalid port"""
172
- is_connected, error = DatabaseManager.test_connection(
173
- "neo4j://localhost:9999", "neo4j", "password123"
174
- )
175
- assert is_connected is False
176
- assert error is not None
177
- # Should mention connectivity or unavailability
178
- assert any(keyword in error for keyword in ["reach", "unavailable", "failed", "Connection"])
179
-
180
- def test_connection_provides_troubleshooting_tips(self):
181
- """Test that error messages include troubleshooting tips"""
182
- is_connected, error = DatabaseManager.test_connection(
183
- "neo4j://localhost:9999", "neo4j", "password123"
184
- )
185
- assert is_connected is False
186
- assert error is not None
187
- # Should provide helpful troubleshooting
188
- assert any(keyword in error.lower() for keyword in ["troubleshoot", "check", "docker", "try"])
189
-
190
-
191
- class TestValidationIntegration:
192
- """Integration tests for validation in real-world scenarios"""
193
-
194
- def test_validate_aura_style_uri(self):
195
- """Test validation works for Neo4j Aura-style URIs"""
196
- is_valid, error = DatabaseManager.validate_config(
197
- "neo4j+s://abc123.databases.neo4j.io:7687", "neo4j", "password123"
198
- )
199
- assert is_valid is True
200
- assert error is None
201
-
202
- def test_validate_bolt_ssc_uri(self):
203
- """Test validation works for bolt+ssc:// URIs"""
204
- is_valid, error = DatabaseManager.validate_config(
205
- "bolt+ssc://localhost:7687", "neo4j", "password123"
206
- )
207
- assert is_valid is True
208
- assert error is None
209
-
210
- def test_multiple_validation_errors_at_once(self):
211
- """Test validation catches the first error in priority order"""
212
- # URI is invalid, username empty, password empty - should catch URI first
213
- is_valid, error = DatabaseManager.validate_config(
214
- "invalid-uri", "", ""
215
- )
216
- assert is_valid is False
217
- assert "Invalid Neo4j URI format" in error
218
-
219
-
220
- if __name__ == "__main__":
221
- pytest.main([__file__, "-v"])