pytest-mockllm 0.1.0__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.
- pytest_mockllm-0.1.0/.gitignore +125 -0
- pytest_mockllm-0.1.0/CHANGELOG.md +37 -0
- pytest_mockllm-0.1.0/LICENSE +21 -0
- pytest_mockllm-0.1.0/PKG-INFO +544 -0
- pytest_mockllm-0.1.0/README.md +493 -0
- pytest_mockllm-0.1.0/pyproject.toml +119 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/__init__.py +39 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/core.py +358 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/fixtures.py +233 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/integrations/__init__.py +5 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/integrations/langchain.py +253 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/plugin.py +81 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/providers/__init__.py +11 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/providers/anthropic.py +286 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/providers/gemini.py +212 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/providers/openai.py +346 -0
- pytest_mockllm-0.1.0/src/pytest_mockllm/recording.py +231 -0
- pytest_mockllm-0.1.0/tests/__init__.py +1 -0
- pytest_mockllm-0.1.0/tests/conftest.py +3 -0
- pytest_mockllm-0.1.0/tests/test_core.py +85 -0
- pytest_mockllm-0.1.0/tests/test_openai.py +151 -0
- pytest_mockllm-0.1.0/tests/test_plugin.py +102 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
|
|
57
|
+
# Flask stuff:
|
|
58
|
+
instance/
|
|
59
|
+
.webassets-cache
|
|
60
|
+
|
|
61
|
+
# Scrapy stuff:
|
|
62
|
+
.scrapy
|
|
63
|
+
|
|
64
|
+
# Sphinx documentation
|
|
65
|
+
docs/_build/
|
|
66
|
+
|
|
67
|
+
# PyBuilder
|
|
68
|
+
target/
|
|
69
|
+
|
|
70
|
+
# Jupyter Notebook
|
|
71
|
+
.ipynb_checkpoints
|
|
72
|
+
|
|
73
|
+
# IPython
|
|
74
|
+
profile_default/
|
|
75
|
+
ipython_config.py
|
|
76
|
+
|
|
77
|
+
# pyenv
|
|
78
|
+
.python-version
|
|
79
|
+
|
|
80
|
+
# celery beat schedule file
|
|
81
|
+
celerybeat-schedule
|
|
82
|
+
|
|
83
|
+
# SageMath parsed files
|
|
84
|
+
*.sage.py
|
|
85
|
+
|
|
86
|
+
# Environments
|
|
87
|
+
.env
|
|
88
|
+
.venv
|
|
89
|
+
env/
|
|
90
|
+
venv/
|
|
91
|
+
ENV/
|
|
92
|
+
env.bak/
|
|
93
|
+
venv.bak/
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# mkdocs documentation
|
|
103
|
+
/site
|
|
104
|
+
|
|
105
|
+
# mypy
|
|
106
|
+
.mypy_cache/
|
|
107
|
+
.dmypy.json
|
|
108
|
+
dmypy.json
|
|
109
|
+
|
|
110
|
+
# Pyre type checker
|
|
111
|
+
.pyre/
|
|
112
|
+
|
|
113
|
+
# IDE
|
|
114
|
+
.idea/
|
|
115
|
+
.vscode/
|
|
116
|
+
*.swp
|
|
117
|
+
*.swo
|
|
118
|
+
*~
|
|
119
|
+
|
|
120
|
+
# LLM cassettes (local testing)
|
|
121
|
+
tests/llm_cassettes/
|
|
122
|
+
|
|
123
|
+
# OS
|
|
124
|
+
.DS_Store
|
|
125
|
+
Thumbs.db
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2024-12-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- 🎉 Initial release of pytest-mockllm
|
|
15
|
+
- ✨ Zero-config pytest plugin with automatic discovery
|
|
16
|
+
- 🤖 **OpenAI mock** - Full support for Chat Completions, Embeddings, and Images API
|
|
17
|
+
- Streaming responses with proper SSE format
|
|
18
|
+
- Function calling / tool use support
|
|
19
|
+
- Token usage simulation
|
|
20
|
+
- 🧠 **Anthropic mock** - Claude Messages API support
|
|
21
|
+
- Streaming responses
|
|
22
|
+
- Tool use support
|
|
23
|
+
- 💎 **Google Gemini mock** - GenerativeAI API support
|
|
24
|
+
- Chat and content generation
|
|
25
|
+
- Streaming support
|
|
26
|
+
- 🦜 **LangChain integration** - Native support for LangChain's ChatModel interface
|
|
27
|
+
- 📼 **Response recording** - VCR-like recording and replay for golden tests
|
|
28
|
+
- 💰 **Cost estimation** - Mock and assert on token usage and API costs
|
|
29
|
+
- ⚡ **Chaos testing** - Simulate rate limits, timeouts, and API errors
|
|
30
|
+
- 📝 Comprehensive documentation and examples
|
|
31
|
+
|
|
32
|
+
### Security
|
|
33
|
+
|
|
34
|
+
- No external network calls in mock mode (completely isolated testing)
|
|
35
|
+
|
|
36
|
+
[Unreleased]: https://github.com/godhiraj-code/pytest-mockllm/compare/v0.1.0...HEAD
|
|
37
|
+
[0.1.0]: https://github.com/godhiraj-code/pytest-mockllm/releases/tag/v0.1.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dhiraj Das (www.dhirajdas.dev)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|