tINI-test 0.5.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.
Files changed (72) hide show
  1. tini_test-0.5.0/.gitignore +230 -0
  2. tini_test-0.5.0/.python-version +1 -0
  3. tini_test-0.5.0/LICENSE +21 -0
  4. tini_test-0.5.0/PKG-INFO +266 -0
  5. tini_test-0.5.0/README.md +253 -0
  6. tini_test-0.5.0/TODO +13 -0
  7. tini_test-0.5.0/fake_real_tests/DISABLED___this_tests_should_fail/DISABLED___tests/test_broken_test.py +16 -0
  8. tini_test-0.5.0/fake_real_tests/DISABLED___this_tests_should_fail/DISABLED___tests/test_cleanup_works_on_fail.py +69 -0
  9. tini_test-0.5.0/fake_real_tests/DISABLED___this_tests_should_fail/DISABLED___tests/test_db_cov.py +46 -0
  10. tini_test-0.5.0/fake_real_tests/DISABLED___this_tests_should_fail/DISABLED___tests/test_fails.py +71 -0
  11. tini_test-0.5.0/fake_real_tests/DISABLED___this_tests_should_fail/DISABLED___tests/test_fails_to_collect.py +29 -0
  12. tini_test-0.5.0/fake_real_tests/DISABLED___this_tests_should_fail/DISABLED___tests/test_must_equal_breaks.py +42 -0
  13. tini_test-0.5.0/fake_real_tests/test_dir/tests/test_smth.py +0 -0
  14. tini_test-0.5.0/fake_real_tests/test_module_collector/tests/test_collector.py +246 -0
  15. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/json_actual.json +227 -0
  16. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/json_actual_broken.json +227 -0
  17. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/json_expected.json +227 -0
  18. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_bigg_diffs.py +1459 -0
  19. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_bools.py +109 -0
  20. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_bytes.py +135 -0
  21. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_dicts.py +110 -0
  22. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_floats.py +104 -0
  23. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_ints.py +113 -0
  24. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_json.py +160 -0
  25. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_lists.py +113 -0
  26. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_misc.py +203 -0
  27. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_more_misc.py +474 -0
  28. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_sets.py +143 -0
  29. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_strings.py +316 -0
  30. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_tuples.py +112 -0
  31. tini_test-0.5.0/fake_real_tests/test_must_equals/tests/test_must_equal_works.py +211 -0
  32. tini_test-0.5.0/fake_real_tests/testing_discovery/testing_discovery/testing_discovery/tests/test_all.py +8 -0
  33. tini_test-0.5.0/fake_real_tests/tests/test_cleanup.py +55 -0
  34. tini_test-0.5.0/fake_real_tests/tests/test_db_setup_cleanup.py +566 -0
  35. tini_test-0.5.0/fake_real_tests/tests/test_decorator_with_lambdas.py +141 -0
  36. tini_test-0.5.0/fake_real_tests/tests/test_decorator_works.py +67 -0
  37. tini_test-0.5.0/fake_real_tests/tests/test_enums.py +25 -0
  38. tini_test-0.5.0/fake_real_tests/tests/test_internals_must_equal.py +382 -0
  39. tini_test-0.5.0/fake_real_tests/tests/test_setup.py +16 -0
  40. tini_test-0.5.0/fake_real_tests/tests/test_suite.py +314 -0
  41. tini_test-0.5.0/fake_real_tests/tests/test_will_raise.py +85 -0
  42. tini_test-0.5.0/fake_real_tests/this_tests_should_fail_but_we_made_them_pass/tests/test_broken_test.py +21 -0
  43. tini_test-0.5.0/fake_real_tests/this_tests_should_fail_but_we_made_them_pass/tests/test_cleanup_works_on_fail.py +86 -0
  44. tini_test-0.5.0/fake_real_tests/this_tests_should_fail_but_we_made_them_pass/tests/test_fails.py +74 -0
  45. tini_test-0.5.0/fake_real_tests/this_tests_should_fail_but_we_made_them_pass/tests/testing_discovery/testing_discovery/testing_discovery/test_wont_run.py +8 -0
  46. tini_test-0.5.0/fake_real_tests/this_tests_should_fail_but_we_made_them_pass/tests/testing_discovery/testing_discovery/testing_discovery/tests/test_all.py +7 -0
  47. tini_test-0.5.0/fake_real_tests/this_tests_should_fail_but_we_made_them_pass/tests/testing_discovery/testing_discovery/testing_discovery/tests/wont_run.py +8 -0
  48. tini_test-0.5.0/mypy.ini +3 -0
  49. tini_test-0.5.0/pyproject.toml +35 -0
  50. tini_test-0.5.0/src/tini_test/__init__.py +11 -0
  51. tini_test-0.5.0/src/tini_test/__main__.py +24 -0
  52. tini_test-0.5.0/src/tini_test/_internals/_equals_engine.py +144 -0
  53. tini_test-0.5.0/src/tini_test/_internals/_internal_exceptions/_comparison_exceptions.py +107 -0
  54. tini_test-0.5.0/src/tini_test/_internals/_locked.py +0 -0
  55. tini_test-0.5.0/src/tini_test/_internals/_registry.py +2 -0
  56. tini_test-0.5.0/src/tini_test/_internals/consts.py +25 -0
  57. tini_test-0.5.0/src/tini_test/arg_parser.py +62 -0
  58. tini_test-0.5.0/src/tini_test/context_managers.py +89 -0
  59. tini_test-0.5.0/src/tini_test/core.py +225 -0
  60. tini_test-0.5.0/src/tini_test/enums.py +156 -0
  61. tini_test-0.5.0/src/tini_test/initializer.py +32 -0
  62. tini_test-0.5.0/src/tini_test/misc/annotations.py +39 -0
  63. tini_test-0.5.0/src/tini_test/misc/exceptions.py +57 -0
  64. tini_test-0.5.0/src/tini_test/module_collector.py +168 -0
  65. tini_test-0.5.0/src/tini_test/must_equals.py +479 -0
  66. tini_test-0.5.0/src/tini_test/py.typed +0 -0
  67. tini_test-0.5.0/src/tini_test/state/state.py +172 -0
  68. tini_test-0.5.0/src/tini_test/test.py +265 -0
  69. tini_test-0.5.0/src/tini_test/test_utils.py +261 -0
  70. tini_test-0.5.0/start.sh +4 -0
  71. tini_test-0.5.0/testing_discovery_more/testing_discovery/testing_discovery/testing_discovery/tests/test_all.py +7 -0
  72. tini_test-0.5.0/uv.lock +12 -0
@@ -0,0 +1,230 @@
1
+ # 1127 tests with source
2
+ test_stress
3
+ test_stress_copy
4
+ test_stress_copy_1
5
+ test_stress_copy_2
6
+ test_stress_copy_3
7
+ test_stress_copy_4
8
+ test_stress_copy_5
9
+ test_stress_copy_6
10
+
11
+ # Byte-compiled / optimized / DLL files
12
+ __pycache__/
13
+ *.py[codz]
14
+ *$py.class
15
+
16
+ # C extensions
17
+ *.so
18
+
19
+ # Distribution / packaging
20
+ .Python
21
+ build/
22
+ develop-eggs/
23
+ dist/
24
+ downloads/
25
+ eggs/
26
+ .eggs/
27
+ lib/
28
+ lib64/
29
+ parts/
30
+ sdist/
31
+ var/
32
+ wheels/
33
+ share/python-wheels/
34
+ *.egg-info/
35
+ .installed.cfg
36
+ *.egg
37
+ MANIFEST
38
+
39
+ # PyInstaller
40
+ # Usually these files are written by a python script from a template
41
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
42
+ *.manifest
43
+ *.spec
44
+
45
+ # Installer logs
46
+ pip-log.txt
47
+ pip-delete-this-directory.txt
48
+
49
+ # Unit test / coverage reports
50
+ htmlcov/
51
+ .tox/
52
+ .nox/
53
+ .coverage
54
+ .coverage.*
55
+ .cache
56
+ nosetests.xml
57
+ coverage.xml
58
+ *.cover
59
+ *.py.cover
60
+ *.lcov
61
+ .hypothesis/
62
+ .pytest_cache/
63
+ cover/
64
+
65
+ # Translations
66
+ *.mo
67
+ *.pot
68
+
69
+ # Django stuff:
70
+ *.log
71
+ local_settings.py
72
+ db.sqlite3
73
+ db.sqlite3-journal
74
+
75
+ # Flask stuff:
76
+ instance/
77
+ .webassets-cache
78
+
79
+ # Scrapy stuff:
80
+ .scrapy
81
+
82
+ # Sphinx documentation
83
+ docs/_build/
84
+
85
+ # PyBuilder
86
+ .pybuilder/
87
+ target/
88
+
89
+ # Jupyter Notebook
90
+ .ipynb_checkpoints
91
+
92
+ # IPython
93
+ profile_default/
94
+ ipython_config.py
95
+
96
+ # pyenv
97
+ # For a library or package, you might want to ignore these files since the code is
98
+ # intended to run in multiple environments; otherwise, check them in:
99
+ # .python-version
100
+
101
+ # pipenv
102
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
103
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
104
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
105
+ # install all needed dependencies.
106
+ # Pipfile.lock
107
+
108
+ # UV
109
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
110
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
111
+ # commonly ignored for libraries.
112
+ # uv.lock
113
+
114
+ # poetry
115
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
116
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
117
+ # commonly ignored for libraries.
118
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
119
+ # poetry.lock
120
+ # poetry.toml
121
+
122
+ # pdm
123
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
124
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
125
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
126
+ # pdm.lock
127
+ # pdm.toml
128
+ .pdm-python
129
+ .pdm-build/
130
+
131
+ # pixi
132
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
133
+ # pixi.lock
134
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
135
+ # in the .venv directory. It is recommended not to include this directory in version control.
136
+ .pixi/*
137
+ !.pixi/config.toml
138
+
139
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
140
+ __pypackages__/
141
+
142
+ # Celery stuff
143
+ celerybeat-schedule*
144
+ celerybeat.pid
145
+
146
+ # Redis
147
+ *.rdb
148
+ *.aof
149
+ *.pid
150
+
151
+ # RabbitMQ
152
+ mnesia/
153
+ rabbitmq/
154
+ rabbitmq-data/
155
+
156
+ # ActiveMQ
157
+ activemq-data/
158
+
159
+ # SageMath parsed files
160
+ *.sage.py
161
+
162
+ # Environments
163
+ .env
164
+ .envrc
165
+ .venv
166
+ env/
167
+ venv/
168
+ ENV/
169
+ env.bak/
170
+ venv.bak/
171
+
172
+ # Spyder project settings
173
+ .spyderproject
174
+ .spyproject
175
+
176
+ # Rope project settings
177
+ .ropeproject
178
+
179
+ # mkdocs documentation
180
+ /site
181
+
182
+ # mypy
183
+ .mypy_cache/
184
+ .dmypy.json
185
+ dmypy.json
186
+
187
+ # Pyre type checker
188
+ .pyre/
189
+
190
+ # pytype static type analyzer
191
+ .pytype/
192
+
193
+ # Cython debug symbols
194
+ cython_debug/
195
+
196
+ # PyCharm
197
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
198
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
199
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
200
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
201
+ # .idea/
202
+
203
+ # Abstra
204
+ # Abstra is an AI-powered process automation framework.
205
+ # Ignore directories containing user credentials, local state, and settings.
206
+ # Learn more at https://abstra.io/docs
207
+ .abstra/
208
+
209
+ # Visual Studio Code
210
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
211
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
212
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
213
+ # you could uncomment the following to ignore the entire vscode folder
214
+ # .vscode/
215
+ # Temporary file for partial code execution
216
+ tempCodeRunnerFile.py
217
+
218
+ # Ruff stuff:
219
+ .ruff_cache/
220
+
221
+ # PyPI configuration file
222
+ .pypirc
223
+
224
+ # Marimo
225
+ marimo/_static/
226
+ marimo/_lsp/
227
+ __marimo__/
228
+
229
+ # Streamlit
230
+ .streamlit/secrets.toml
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2026] [Aggelos Arelakis]
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.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: tINI-test
3
+ Version: 0.5.0
4
+ Summary: A small library/framework used for testing your python source code.
5
+ Project-URL: Homepage, https://github.com/AggelosAr/tini_test
6
+ Author-email: Aggelos Arelakis <aggelosarelakis@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ # tINI test
15
+
16
+ A lightweight Python test framework focused on simple test discovery and execution from the command line.
17
+ The framework was tested using its own test suite and has 100% coverage. It was also stress tested on around 1K tests to test db connections on a temp sqlite3. It also allows pretty prints inside the tests while running.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install tini_test
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ python3 -m tini_test [-r RUN MODE] [-v VERBOSITY] [-d DIRECTORY] [-f FILE] [-t TEST] [-h HELP]
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Filter Combination Behavior
34
+
35
+ Filters are applied from broadest to narrowest scope:
36
+
37
+ 1. Discover tests within `-d` (if provided)
38
+ 2. Restrict to `-f` (if provided)
39
+ 3. Restrict to `-t` (if provided)
40
+ * If used alone, the entire project is scanned.
41
+ * Options may be combined in any way.
42
+
43
+ ---
44
+
45
+ ## Test Registration
46
+
47
+ ```python
48
+ @Test.case
49
+ def test_cats() -> None:
50
+ ...
51
+
52
+ @Test.case()
53
+ def snakes() -> None:
54
+ ...
55
+ ```
56
+
57
+ The decorator accepts up to two optional callables.
58
+
59
+
60
+ ```python
61
+ @Test.case(
62
+ lambda: create_database(),
63
+ lambda: destroy_database()
64
+ )
65
+ def test_database() -> None:
66
+ ...
67
+
68
+ @Test.case(setup, lambda: destr())
69
+ def test_database() -> None:
70
+ ...
71
+ ```
72
+
73
+
74
+
75
+ ### Catch exceptions
76
+
77
+ ```python
78
+ @Test.case
79
+ def test_math() -> None:
80
+
81
+ with WillRaise(NameError, ZeroDivisionError):
82
+ 1/0
83
+ ```
84
+ Notes: If one of the provided exceptions is not raised the test will fail and raise an `ExceptionWasNotRaised` error.
85
+
86
+ ### Comparisons
87
+
88
+ ```python
89
+ @Test.case
90
+ def test_list_values() -> None:
91
+
92
+ expected = [12345]
93
+ must_equal(expected, some_func())
94
+ ```
95
+
96
+ ### Combo
97
+
98
+ ```python
99
+ @Test.case
100
+ def test_ints_dont_match() -> None:
101
+ a = 10
102
+ b = 20
103
+
104
+ with WillRaise(_IntegerMismatchError) as context:
105
+ must_equal(a, b)
106
+
107
+ must_equal('10 != 20', str(context.exception))
108
+
109
+ ```
110
+
111
+
112
+ ### Misc
113
+
114
+ When comparing custom objects the test suite will try to autocompare them but it is better to be explicit and pass them a callable that will apply the correct comparison.
115
+
116
+ ```python
117
+ @Test.case
118
+ def test_must_equal_alien_object_with_eq() -> None:
119
+
120
+ expected = A(11)
121
+ actual = A(21)
122
+
123
+ comp_func = lambda a, b: a.attr == b.attr
124
+
125
+ must_equal(expected, actual, comp_func)
126
+
127
+ ```
128
+
129
+ ## Test Discovery
130
+
131
+ The requested path is resolved relative to the current working directory.
132
+
133
+ A file is considered discoverable when:
134
+
135
+ * The file name begins with `test_`
136
+ * The file exists inside a directory named `tests`
137
+
138
+
139
+
140
+
141
+ ### Flow
142
+
143
+ - Setup is executed before the test function runs.
144
+
145
+
146
+ - Cleanup is executed after the test function completes.
147
+
148
+ - Cleanup execution is still attempted when setup or test execution fails.
149
+
150
+ - Maybe further down the road this will be made optional by a flag.
151
+
152
+ ---
153
+
154
+ ### Run modes
155
+ Currently there are two modes *_sync_* amd *_async_*.
156
+ In _sync_ mode all tests run in sequential and in _async_ they run concurrently.
157
+ ```bash
158
+ tini_test -r sync
159
+ ```
160
+
161
+ ---
162
+
163
+ ### `-d DIRECTORY`
164
+
165
+ Limit test discovery to a specific directory.
166
+
167
+ ```bash
168
+ tini_test -d test_math
169
+ ```
170
+
171
+ All tests in the `test_math` dir will run.
172
+
173
+
174
+ ---
175
+
176
+ ### `-f FILE`
177
+
178
+ Limit execution to tests contained in a specific file.
179
+
180
+
181
+ ```bash
182
+ python3 -m tini_test -f test_concurrency
183
+ python3 -m tini_test -f test_concurrency.py
184
+ ```
185
+
186
+
187
+ Notes:
188
+ If multiple files with same name exist in different directories all will run.
189
+
190
+
191
+ ---
192
+
193
+ ### `-t TEST`
194
+
195
+ Run a specific test function.
196
+
197
+
198
+ ```bash
199
+ python3 -m tini_test -t function_name
200
+ ```
201
+
202
+
203
+ Notes:
204
+ If multiple functions with the same name are defined in different files only the first one spotted will run.
205
+
206
+ ---
207
+
208
+
209
+
210
+ ## Verbosity Modes
211
+
212
+ ### NORMAL
213
+
214
+ Displays:
215
+
216
+ * Captured IO in the correct order
217
+ * Setup execution (if any)
218
+ * Test execution (if any)
219
+ * Cleanup execution (if any)
220
+ * Full exception details
221
+ * Stack traces
222
+ * Test discovery information
223
+ * Final summary stats
224
+ ---
225
+
226
+ ### SORT
227
+
228
+ Works the same way as normal. But failures are sorted to the bottom.
229
+
230
+ The sorting is only applied per module .
231
+
232
+ *Maybe further down the road a flag to sort globally may be introduced.
233
+
234
+ ---
235
+
236
+ ### MINIMAL
237
+
238
+ Minimal display:
239
+
240
+ * Failed tests ( names only )
241
+ * Associated stack traces
242
+ * Final execution summary
243
+
244
+
245
+ `MINIMAL_NO_STACK` is same as `MINIMAL`, except that no stack traces are shown.
246
+ `SUPER_MINIMAL` is same as `MINIMAL_NO_STACK` but less verbose.
247
+
248
+ ---
249
+
250
+
251
+ ## Notes
252
+
253
+
254
+ While the discovery implementation will find tests with the same names or sub dirs with same names or even actual tests cases with same names, it is heavily discouraged.
255
+
256
+ Of course the above is somewhat cancelled because the algorithm tries to autocomplete the path, as a result when searching for a sub directory that exists in multiple sub directories with the same name, no guarantees are made that all tests will be excecuted.
257
+
258
+
259
+ ---
260
+
261
+
262
+ ## Roadmap
263
+
264
+ * [ ] Register tests into groups (group-level setup/cleanup)
265
+ * [ ] Add global fail sort mode, not just per module.
266
+ * [ ] Add exclude dir arg