testgenie-py 0.2.2__tar.gz → 0.2.3__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 (68) hide show
  1. testgenie_py-0.2.3/PKG-INFO +139 -0
  2. testgenie_py-0.2.3/README.md +112 -0
  3. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/pyproject.toml +2 -2
  4. testgenie_py-0.2.2/PKG-INFO +0 -27
  5. testgenie_py-0.2.2/README.md +0 -0
  6. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/__init__.py +0 -0
  7. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/__init__.py +0 -0
  8. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/ast_analyzer.py +0 -0
  9. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/contracts/__init__.py +0 -0
  10. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/contracts/contract.py +0 -0
  11. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/contracts/no_exception_contract.py +0 -0
  12. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/contracts/nonnull_contract.py +0 -0
  13. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/fuzz_analyzer.py +0 -0
  14. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/random_feedback_analyzer.py +0 -0
  15. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/reinforcement_analyzer.py +0 -0
  16. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/test_case_analyzer.py +0 -0
  17. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/analyzer/test_case_analyzer_context.py +0 -0
  18. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/controller/__init__.py +0 -0
  19. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/controller/cli_controller.py +0 -0
  20. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/controller/docker_controller.py +0 -0
  21. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/docker/Dockerfile +0 -0
  22. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generated_samplecodebin.py +0 -0
  23. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/__init__.py +0 -0
  24. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/code_generator.py +0 -0
  25. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/doctest_generator.py +0 -0
  26. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/generator.py +0 -0
  27. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/pytest_generator.py +0 -0
  28. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/test_generator.py +0 -0
  29. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/generator/unit_test_generator.py +0 -0
  30. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/inspector/__init__.py +0 -0
  31. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/inspector/inspector.py +0 -0
  32. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/main.py +0 -0
  33. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/models/__init__.py +0 -0
  34. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/models/analysis_context.py +0 -0
  35. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/models/function_metadata.py +0 -0
  36. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/models/generator_context.py +0 -0
  37. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/models/test_case.py +0 -0
  38. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/presentation/__init__.py +0 -0
  39. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/presentation/cli_view.py +0 -0
  40. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/reinforcement/__init__.py +0 -0
  41. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/reinforcement/abstract_state.py +0 -0
  42. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/reinforcement/agent.py +0 -0
  43. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/reinforcement/environment.py +0 -0
  44. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/reinforcement/statement_coverage_state.py +0 -0
  45. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/service/__init__.py +0 -0
  46. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/service/analysis_service.py +0 -0
  47. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/service/cfg_service.py +0 -0
  48. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/service/generator_service.py +0 -0
  49. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/service/logging_service.py +0 -0
  50. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/service/service.py +0 -0
  51. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/sqlite/__init__.py +0 -0
  52. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/sqlite/db.py +0 -0
  53. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/sqlite/db_service.py +0 -0
  54. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/tree/__init__.py +0 -0
  55. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/tree/node.py +0 -0
  56. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/tree/tree_utils.py +0 -0
  57. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/__init__.py +0 -0
  58. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/coverage_utils.py +0 -0
  59. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/coverage_visualizer.py +0 -0
  60. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/file_utils.py +0 -0
  61. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/randomizer.py +0 -0
  62. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/utils.py +0 -0
  63. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/z3_utils/__init__.py +0 -0
  64. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/z3_utils/ast_to_z3.py +0 -0
  65. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/z3_utils/branch_condition.py +0 -0
  66. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/z3_utils/constraint_extractor.py +0 -0
  67. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/z3_utils/variable_finder.py +0 -0
  68. {testgenie_py-0.2.2 → testgenie_py-0.2.3}/testgen/util/z3_utils/z3_test_case.py +0 -0
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.3
2
+ Name: testgenie-py
3
+ Version: 0.2.3
4
+ Summary: Automated unit test generation tool for Python.
5
+ Author: cjseitz
6
+ Author-email: charlesjseitz@gmail.com
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Dist: ConfigArgParse (==1.7)
14
+ Requires-Dist: astor (==0.8.1)
15
+ Requires-Dist: atheris (==2.3.0)
16
+ Requires-Dist: coverage (==7.6.4)
17
+ Requires-Dist: docker (>=7.1.0,<8.0.0)
18
+ Requires-Dist: klara (==0.6.3)
19
+ Requires-Dist: pygraphviz (>=1.14,<2.0)
20
+ Requires-Dist: pytest (>=8.3.5,<9.0.0)
21
+ Requires-Dist: staticfg (>=0.9.5,<0.10.0)
22
+ Requires-Dist: tabulate (>=0.9.0,<0.10.0)
23
+ Requires-Dist: typed-ast (==1.5.5)
24
+ Requires-Dist: z3-solver (==4.13.3.0)
25
+ Description-Content-Type: text/markdown
26
+
27
+ # TestGenie
28
+
29
+ **TestGenie** is an automated unit test generation tool for Python that supports multiple test generation strategies, including static AST analysis, fuzz testing, feedback-directed random testing, and reinforcement learning.
30
+ Built with a modular Pipe and Filter architecture, it analyzes Python source code to extract function metadata, generates meaningful test cases, and outputs executable test suites in formats like Unittest, PyTest, or Doctest.
31
+ The system can also measure and report code coverage and safely execute tests in Docker containers.
32
+ TestGenie aims to reduce manual testing effort, improve coverage, and explore the potential of learning-based approaches for optimizing test generation.
33
+
34
+ ---
35
+
36
+ ## Installation
37
+
38
+ Make sure you have **Python 3.10+** and **Poetry** installed.
39
+
40
+ Install dependencies:
41
+
42
+ ```bash
43
+ poetry install
44
+ ```
45
+
46
+ Activate the virtual environment:
47
+
48
+ ```bash
49
+ poetry shell
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Running the CLI
55
+
56
+ To invoke the test generator, run:
57
+
58
+ ```bash
59
+ poetry run python -m testgen.main <file_path> [options]
60
+ ```
61
+
62
+ **Required Argument:**
63
+ - `<file_path>`: Path to the Python module you want to analyze.
64
+
65
+ ---
66
+
67
+ ## Command-Line Options
68
+
69
+ | Command/Flag | Description |
70
+ |:---|:---|
71
+ | `--output, -o <path>` | Path to output directory for generated test files (default: `./tests`) |
72
+ | `--generate-only, -g` | Only generate test code, skip running tests and measuring coverage |
73
+ | `--test-mode <mode>` | Set the test analysis strategy: `ast` (default), `random`, `fuzz`, or `reinforce` |
74
+ | `--test-format <format>` | Set the test output format: `unittest` (default), `pytest`, or `doctest` |
75
+ | `--safe` | Run test generation inside a Docker container for isolation and safety |
76
+ | `--query, -q` | Query the database for test cases, coverage data, and test results for a specific file |
77
+ | `--db <db_path>` | Path to SQLite database file (default: `testgen.db`) |
78
+ | `--reinforce-mode <mode>` | Set mode for reinforcement learning: `train` (default) or `collect` |
79
+ | `--visualize, -viz` | Visualize generated test coverage graphs using Graphviz |
80
+ | `--debug` | Enable debug logging output |
81
+ | `--log-file <path>` | Save logs to the specified file instead of only printing to the console |
82
+
83
+ ---
84
+
85
+ ## Examples
86
+
87
+ Generate and run unit tests for a Python module:
88
+
89
+ ```bash
90
+ poetry run python -m testgen.main mymodule.py
91
+ ```
92
+
93
+ Generate tests using fuzzing strategy and output to a custom directory:
94
+
95
+ ```bash
96
+ poetry run python -m testgen.main mymodule.py --test-mode fuzz --output generated_tests/
97
+ ```
98
+
99
+ Run reinforcement learning-based test generation:
100
+
101
+ ```bash
102
+ poetry run python -m testgen.main mymodule.py --test-mode reinforce
103
+ ```
104
+
105
+ Query previously generated test results from the database:
106
+
107
+ ```bash
108
+ poetry run python -m testgen.main mymodule.py --query
109
+ ```
110
+
111
+ Safely generate tests inside a Docker container:
112
+
113
+ ```bash
114
+ poetry run python -m testgen.main mymodule.py --safe
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Features
120
+ - Static analysis using Python AST
121
+ - Fuzz testing using randomized input generation
122
+ - Feedback-directed random testing
123
+ - Reinforcement learning-based test case optimization
124
+ - Supports Unittest, PyTest, and Doctest formats
125
+ - Code coverage measurement and reporting
126
+ - Docker sandboxing for safe test execution
127
+ - SQLite database integration for tracking tests and results
128
+ - CLI visualization of test coverage graphs
129
+
130
+ ---
131
+
132
+ ## Requirements
133
+
134
+ - Python 3.10+
135
+ - Poetry
136
+ - (Optional) Docker (for safe mode execution)
137
+
138
+ ---
139
+
@@ -0,0 +1,112 @@
1
+ # TestGenie
2
+
3
+ **TestGenie** is an automated unit test generation tool for Python that supports multiple test generation strategies, including static AST analysis, fuzz testing, feedback-directed random testing, and reinforcement learning.
4
+ Built with a modular Pipe and Filter architecture, it analyzes Python source code to extract function metadata, generates meaningful test cases, and outputs executable test suites in formats like Unittest, PyTest, or Doctest.
5
+ The system can also measure and report code coverage and safely execute tests in Docker containers.
6
+ TestGenie aims to reduce manual testing effort, improve coverage, and explore the potential of learning-based approaches for optimizing test generation.
7
+
8
+ ---
9
+
10
+ ## Installation
11
+
12
+ Make sure you have **Python 3.10+** and **Poetry** installed.
13
+
14
+ Install dependencies:
15
+
16
+ ```bash
17
+ poetry install
18
+ ```
19
+
20
+ Activate the virtual environment:
21
+
22
+ ```bash
23
+ poetry shell
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Running the CLI
29
+
30
+ To invoke the test generator, run:
31
+
32
+ ```bash
33
+ poetry run python -m testgen.main <file_path> [options]
34
+ ```
35
+
36
+ **Required Argument:**
37
+ - `<file_path>`: Path to the Python module you want to analyze.
38
+
39
+ ---
40
+
41
+ ## Command-Line Options
42
+
43
+ | Command/Flag | Description |
44
+ |:---|:---|
45
+ | `--output, -o <path>` | Path to output directory for generated test files (default: `./tests`) |
46
+ | `--generate-only, -g` | Only generate test code, skip running tests and measuring coverage |
47
+ | `--test-mode <mode>` | Set the test analysis strategy: `ast` (default), `random`, `fuzz`, or `reinforce` |
48
+ | `--test-format <format>` | Set the test output format: `unittest` (default), `pytest`, or `doctest` |
49
+ | `--safe` | Run test generation inside a Docker container for isolation and safety |
50
+ | `--query, -q` | Query the database for test cases, coverage data, and test results for a specific file |
51
+ | `--db <db_path>` | Path to SQLite database file (default: `testgen.db`) |
52
+ | `--reinforce-mode <mode>` | Set mode for reinforcement learning: `train` (default) or `collect` |
53
+ | `--visualize, -viz` | Visualize generated test coverage graphs using Graphviz |
54
+ | `--debug` | Enable debug logging output |
55
+ | `--log-file <path>` | Save logs to the specified file instead of only printing to the console |
56
+
57
+ ---
58
+
59
+ ## Examples
60
+
61
+ Generate and run unit tests for a Python module:
62
+
63
+ ```bash
64
+ poetry run python -m testgen.main mymodule.py
65
+ ```
66
+
67
+ Generate tests using fuzzing strategy and output to a custom directory:
68
+
69
+ ```bash
70
+ poetry run python -m testgen.main mymodule.py --test-mode fuzz --output generated_tests/
71
+ ```
72
+
73
+ Run reinforcement learning-based test generation:
74
+
75
+ ```bash
76
+ poetry run python -m testgen.main mymodule.py --test-mode reinforce
77
+ ```
78
+
79
+ Query previously generated test results from the database:
80
+
81
+ ```bash
82
+ poetry run python -m testgen.main mymodule.py --query
83
+ ```
84
+
85
+ Safely generate tests inside a Docker container:
86
+
87
+ ```bash
88
+ poetry run python -m testgen.main mymodule.py --safe
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Features
94
+ - Static analysis using Python AST
95
+ - Fuzz testing using randomized input generation
96
+ - Feedback-directed random testing
97
+ - Reinforcement learning-based test case optimization
98
+ - Supports Unittest, PyTest, and Doctest formats
99
+ - Code coverage measurement and reporting
100
+ - Docker sandboxing for safe test execution
101
+ - SQLite database integration for tracking tests and results
102
+ - CLI visualization of test coverage graphs
103
+
104
+ ---
105
+
106
+ ## Requirements
107
+
108
+ - Python 3.10+
109
+ - Poetry
110
+ - (Optional) Docker (for safe mode execution)
111
+
112
+ ---
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "testgenie-py"
3
- version = "0.2.2"
4
- description = ""
3
+ version = "0.2.3"
4
+ description = "Automated unit test generation tool for Python."
5
5
  authors = ["cjseitz <charlesjseitz@gmail.com>"]
6
6
  readme = "README.md"
7
7
  include = ["testgen/docker/**"]
@@ -1,27 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: testgenie-py
3
- Version: 0.2.2
4
- Summary:
5
- Author: cjseitz
6
- Author-email: charlesjseitz@gmail.com
7
- Requires-Python: >=3.10,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
13
- Requires-Dist: ConfigArgParse (==1.7)
14
- Requires-Dist: astor (==0.8.1)
15
- Requires-Dist: atheris (==2.3.0)
16
- Requires-Dist: coverage (==7.6.4)
17
- Requires-Dist: docker (>=7.1.0,<8.0.0)
18
- Requires-Dist: klara (==0.6.3)
19
- Requires-Dist: pygraphviz (>=1.14,<2.0)
20
- Requires-Dist: pytest (>=8.3.5,<9.0.0)
21
- Requires-Dist: staticfg (>=0.9.5,<0.10.0)
22
- Requires-Dist: tabulate (>=0.9.0,<0.10.0)
23
- Requires-Dist: typed-ast (==1.5.5)
24
- Requires-Dist: z3-solver (==4.13.3.0)
25
- Description-Content-Type: text/markdown
26
-
27
-
File without changes