wrapture 1.0.0.dev6__tar.gz → 1.0.0.dev8__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 (81) hide show
  1. {wrapture-1.0.0.dev6/src/wrapture.egg-info → wrapture-1.0.0.dev8}/PKG-INFO +15 -8
  2. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/README.md +14 -7
  3. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/__init__.py +14 -2
  4. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/attributes.py +343 -64
  5. wrapture-1.0.0.dev8/src/wrapture/behaviours.py +899 -0
  6. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/bindings.py +1136 -138
  7. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/eventlogs.py +23 -0
  8. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/events.py +14 -3
  9. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/exceptions.py +12 -1
  10. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/export.py +1 -0
  11. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/observed.py +19 -9
  12. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/sinks.py +2 -0
  13. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/timeline.py +111 -17
  14. wrapture-1.0.0.dev8/src/wrapture/values.py +163 -0
  15. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/windows.py +24 -2
  16. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8/src/wrapture.egg-info}/PKG-INFO +15 -8
  17. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture.egg-info/SOURCES.txt +7 -0
  18. wrapture-1.0.0.dev8/tests/test_async_stubs.py +450 -0
  19. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_attributes.py +4 -15
  20. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_bindings.py +84 -5
  21. wrapture-1.0.0.dev8/tests/test_mapping.py +383 -0
  22. wrapture-1.0.0.dev8/tests/test_module_attributes.py +389 -0
  23. wrapture-1.0.0.dev8/tests/test_phases.py +918 -0
  24. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_recording.py +7 -5
  25. wrapture-1.0.0.dev8/tests/test_strict.py +228 -0
  26. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_timeline.py +205 -3
  27. wrapture-1.0.0.dev8/tests/test_values.py +535 -0
  28. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_windows.py +76 -0
  29. wrapture-1.0.0.dev6/src/wrapture/behaviours.py +0 -428
  30. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/LICENSE +0 -0
  31. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/pyproject.toml +0 -0
  32. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/setup.cfg +0 -0
  33. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/__main__.py +0 -0
  34. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/asgi.py +0 -0
  35. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/bootstrap.py +0 -0
  36. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/capture.py +0 -0
  37. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/collectors.py +0 -0
  38. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/config.py +0 -0
  39. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/iterators.py +0 -0
  40. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/lifecycle.py +0 -0
  41. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/outputs.py +0 -0
  42. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/py.typed +0 -0
  43. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/pytest_plugin.py +0 -0
  44. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/scheduler.py +0 -0
  45. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/stacks.py +0 -0
  46. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/tools/__init__.py +0 -0
  47. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/tools/__main__.py +0 -0
  48. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/tools/convert.py +0 -0
  49. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture/wsgi.py +0 -0
  50. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture.egg-info/dependency_links.txt +0 -0
  51. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture.egg-info/entry_points.txt +0 -0
  52. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture.egg-info/not-zip-safe +0 -0
  53. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture.egg-info/requires.txt +0 -0
  54. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/src/wrapture.egg-info/top_level.txt +0 -0
  55. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_asgi.py +0 -0
  56. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_attribute_events.py +0 -0
  57. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_behaviours.py +0 -0
  58. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_bootstrap.py +0 -0
  59. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_capture.py +0 -0
  60. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_collectors.py +0 -0
  61. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_config.py +0 -0
  62. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_eventlogs.py +0 -0
  63. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_events.py +0 -0
  64. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_export.py +0 -0
  65. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_generator_events.py +0 -0
  66. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_iterators.py +0 -0
  67. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_jsonlines.py +0 -0
  68. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_observed.py +0 -0
  69. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_outputs.py +0 -0
  70. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_predicates.py +0 -0
  71. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_pytest_plugin.py +0 -0
  72. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_runner.py +0 -0
  73. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_sink_library.py +0 -0
  74. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_sinks.py +0 -0
  75. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_stacks.py +0 -0
  76. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_targets.py +0 -0
  77. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_testing_patterns.py +0 -0
  78. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_threads.py +0 -0
  79. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_tools.py +0 -0
  80. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_version.py +0 -0
  81. {wrapture-1.0.0.dev6 → wrapture-1.0.0.dev8}/tests/test_wsgi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wrapture
3
- Version: 1.0.0.dev6
3
+ Version: 1.0.0.dev8
4
4
  Summary: Monkey patch, test, and trace Python by attaching bindings to call sites, without modifying the code being observed. Built on wrapt.
5
5
  Author-email: Graham Dumpleton <Graham.Dumpleton@gmail.com>
6
6
  License-Expression: BSD-2-Clause
@@ -31,7 +31,7 @@ Dynamic: license-file
31
31
 
32
32
  # wrapture
33
33
 
34
- **Trace assertions without instrumenting your code.**
34
+ **Wrap anything, capture everything, change nothing.**
35
35
 
36
36
  [![Tests](https://github.com/GrahamDumpleton/wrapture/actions/workflows/build-test-release.yml/badge.svg?branch=develop)](https://github.com/GrahamDumpleton/wrapture/actions/workflows/build-test-release.yml)
37
37
  [![Documentation](https://readthedocs.org/projects/wrapture/badge/?version=latest)](https://wrapture.readthedocs.io)
@@ -44,10 +44,10 @@ It is a sibling project to [wrapt](https://github.com/GrahamDumpleton/wrapt)
44
44
  and [autowrapt](https://github.com/GrahamDumpleton/autowrapt), building on the
45
45
  safe monkey-patching machinery wrapt provides.
46
46
 
47
- > **Status: early development.** The monkey patching, unit testing and
48
- > ad-hoc tracing layers are implemented, including WSGI and ASGI request
49
- > tracing. Development previews are published to PyPI; the API may still
50
- > shift before 1.0.0.
47
+ > **Status: stabilising ahead of 1.0.0.** The feature set is complete for
48
+ > a first release and development previews are published to PyPI. The API
49
+ > is being exercised and tidied rather than extended, so small changes are
50
+ > still possible before 1.0.0.
51
51
 
52
52
  ## Installation
53
53
 
@@ -112,8 +112,8 @@ One mechanism, three uses, in increasing order of machinery:
112
112
 
113
113
  2. **Unit testing.** Observe and assert on how calls actually flowed through a
114
114
  *real* call graph (nesting, ordering, arguments and return values) and
115
- optionally intervene (stub, transform, fail-inject). Unlike a `Mock`,
116
- which fabricates values and cannot see calls an object makes to itself,
115
+ optionally intervene (stub, transform, fail-inject). Unlike a
116
+ `unittest.mock` `Mock`, which fabricates values and cannot see calls an object makes to itself,
117
117
  wrapture watches the real code run. This makes it possible to test code
118
118
  with no injectable seams at all, and to assert on what *didn't* happen on
119
119
  an error path: inject a gateway timeout, then verify the ledger was not
@@ -166,6 +166,13 @@ testing assertion library, a tracing tool, or both at once.
166
166
  - Python 3.12+
167
167
  - [wrapt](https://github.com/GrahamDumpleton/wrapt) 2.4.0+
168
168
 
169
+ ## Issues
170
+
171
+ Bug reports and feature requests go to the
172
+ [issue tracker](https://github.com/GrahamDumpleton/wrapture/issues).
173
+ Include the wrapture and Python versions and, where you can, a small
174
+ binding that reproduces the problem.
175
+
169
176
  ## License
170
177
 
171
178
  BSD 2-Clause. See
@@ -1,6 +1,6 @@
1
1
  # wrapture
2
2
 
3
- **Trace assertions without instrumenting your code.**
3
+ **Wrap anything, capture everything, change nothing.**
4
4
 
5
5
  [![Tests](https://github.com/GrahamDumpleton/wrapture/actions/workflows/build-test-release.yml/badge.svg?branch=develop)](https://github.com/GrahamDumpleton/wrapture/actions/workflows/build-test-release.yml)
6
6
  [![Documentation](https://readthedocs.org/projects/wrapture/badge/?version=latest)](https://wrapture.readthedocs.io)
@@ -13,10 +13,10 @@ It is a sibling project to [wrapt](https://github.com/GrahamDumpleton/wrapt)
13
13
  and [autowrapt](https://github.com/GrahamDumpleton/autowrapt), building on the
14
14
  safe monkey-patching machinery wrapt provides.
15
15
 
16
- > **Status: early development.** The monkey patching, unit testing and
17
- > ad-hoc tracing layers are implemented, including WSGI and ASGI request
18
- > tracing. Development previews are published to PyPI; the API may still
19
- > shift before 1.0.0.
16
+ > **Status: stabilising ahead of 1.0.0.** The feature set is complete for
17
+ > a first release and development previews are published to PyPI. The API
18
+ > is being exercised and tidied rather than extended, so small changes are
19
+ > still possible before 1.0.0.
20
20
 
21
21
  ## Installation
22
22
 
@@ -81,8 +81,8 @@ One mechanism, three uses, in increasing order of machinery:
81
81
 
82
82
  2. **Unit testing.** Observe and assert on how calls actually flowed through a
83
83
  *real* call graph (nesting, ordering, arguments and return values) and
84
- optionally intervene (stub, transform, fail-inject). Unlike a `Mock`,
85
- which fabricates values and cannot see calls an object makes to itself,
84
+ optionally intervene (stub, transform, fail-inject). Unlike a
85
+ `unittest.mock` `Mock`, which fabricates values and cannot see calls an object makes to itself,
86
86
  wrapture watches the real code run. This makes it possible to test code
87
87
  with no injectable seams at all, and to assert on what *didn't* happen on
88
88
  an error path: inject a gateway timeout, then verify the ledger was not
@@ -135,6 +135,13 @@ testing assertion library, a tracing tool, or both at once.
135
135
  - Python 3.12+
136
136
  - [wrapt](https://github.com/GrahamDumpleton/wrapt) 2.4.0+
137
137
 
138
+ ## Issues
139
+
140
+ Bug reports and feature requests go to the
141
+ [issue tracker](https://github.com/GrahamDumpleton/wrapture/issues).
142
+ Include the wrapture and Python versions and, where you can, a small
143
+ binding that reproduces the problem.
144
+
138
145
  ## License
139
146
 
140
147
  BSD 2-Clause. See
@@ -17,19 +17,23 @@ def _format_version(parts: tuple[str, ...]) -> str:
17
17
  )
18
18
 
19
19
 
20
- __version_info__ = ("1", "0", "0", "dev6")
20
+ __version_info__ = ("1", "0", "0", "dev8")
21
21
  __version__ = _format_version(__version_info__)
22
22
 
23
- from wrapt import MISSING
23
+ from wrapt import MISSING, register_post_import_hook, when_imported
24
24
 
25
25
  from .asgi import (
26
26
  ASGIMiddleware,
27
27
  )
28
28
  from .behaviours import (
29
29
  CallBehaviour,
30
+ CallPhase,
30
31
  DeleteBehaviour,
32
+ DeletePhase,
31
33
  GetBehaviour,
34
+ GetPhase,
32
35
  SetBehaviour,
36
+ SetPhase,
33
37
  )
34
38
  from .bindings import (
35
39
  Binding,
@@ -69,6 +73,7 @@ from .exceptions import (
69
73
  NeverAppliedError,
70
74
  NotImplementedYetError,
71
75
  RecordingGapWarning,
76
+ SequenceExhaustedError,
72
77
  SinkErrorWarning,
73
78
  WrongModeError,
74
79
  )
@@ -131,6 +136,8 @@ from .wsgi import (
131
136
 
132
137
  __all__ = [
133
138
  "MISSING",
139
+ "register_post_import_hook",
140
+ "when_imported",
134
141
  "ASGIMiddleware",
135
142
  "Aggregate",
136
143
  "AlreadyAppliedError",
@@ -142,12 +149,14 @@ __all__ = [
142
149
  "Window",
143
150
  "BindingGroup",
144
151
  "CallBehaviour",
152
+ "CallPhase",
145
153
  "Config",
146
154
  "ConfigError",
147
155
  "ConfigWarning",
148
156
  "Counter",
149
157
  "DeferredTargetError",
150
158
  "DeleteBehaviour",
159
+ "DeletePhase",
151
160
  "Depth",
152
161
  "Event",
153
162
  "EventLog",
@@ -155,6 +164,7 @@ __all__ = [
155
164
  "Fanout",
156
165
  "Filter",
157
166
  "GetBehaviour",
167
+ "GetPhase",
158
168
  "IteratorAbandonBehaviour",
159
169
  "IteratorErrorBehaviour",
160
170
  "IteratorFinishBehaviour",
@@ -169,7 +179,9 @@ __all__ = [
169
179
  "Printer",
170
180
  "RecordingGapWarning",
171
181
  "Sample",
182
+ "SequenceExhaustedError",
172
183
  "SetBehaviour",
184
+ "SetPhase",
173
185
  "SetupEntry",
174
186
  "Sink",
175
187
  "SinkErrorWarning",