pytest-pyspec 0.8.2__tar.gz → 1.0.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.

Potentially problematic release.


This version of pytest-pyspec might be problematic. Click here for more details.

@@ -0,0 +1,130 @@
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
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+ .vscode
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-pyspec
3
+ Version: 1.0.0
4
+ Summary: A plugin that transforms the pytest output into a result similar to the RSpec. It enables the use of docstrings to display results and also enables the use of the prefixes "describe", "with" and "it".
5
+ Project-URL: Repository, https://github.com/felipecrp/pytest-pyspec
6
+ Project-URL: Issues, https://github.com/felipecrp/pytest-pyspec/issues
7
+ Author-email: Felipe Curty <felipecrp@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Operating System :: Unix
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: <4,>=3.10
26
+ Requires-Dist: pytest<10,>=9
27
+ Description-Content-Type: text/markdown
28
+
29
+ [![](https://github.com/felipecrp/pytest-pyspec/actions/workflows/pytest.yml/badge.svg)](https://github.com/felipecrp/pytest-pyspec/actions/workflows/pytest.yml)
30
+
31
+ # pytest-pyspec
32
+
33
+ The **pytest-pyspec** plugin transforms pytest output into a beautiful, readable format similar to RSpec. It provides semantic meaning to your tests by organizing them into descriptive hierarchies.
34
+
35
+ ## Features
36
+
37
+ - **Semantic Output**: Transform pytest's default output into readable, hierarchical descriptions
38
+ - **Multiple Prefixes**: Support for `describe/test` (objects), `with/without/when` (contexts), and `it/test` (tests)
39
+ - **Docstring Support**: Override test descriptions using docstrings
40
+ - **Consolidated Output**: Smart grouping that avoids repeating parent headers
41
+ - **Natural Language**: Automatic lowercase formatting of common words (the, is, are, etc.)
42
+
43
+ ## Quick Start
44
+
45
+ ### Installation
46
+
47
+ ```bash
48
+ pip install pytest pytest-pyspec
49
+ ```
50
+
51
+ ### Running
52
+
53
+ ```bash
54
+ pytest --pyspec
55
+ ```
56
+
57
+ ## Examples
58
+
59
+ ### Car Scenario
60
+
61
+ A minimal car example with properties and behaviors:
62
+
63
+ ```python
64
+ class DescribeCar:
65
+ def test_has_engine(self):
66
+ assert True
67
+
68
+ class WithFullTank:
69
+ def test_drive_long_distance(self):
70
+ assert True
71
+
72
+ class WithoutFuel:
73
+ def test_cannot_start_engine(self):
74
+ assert True
75
+
76
+ class WhenTheEngineIsRunning:
77
+ def test_consumes_fuel(self):
78
+ assert True
79
+ ```
80
+
81
+ With **pytest-pyspec**, this produces:
82
+
83
+ ```
84
+ a Car
85
+ ✓ has engine
86
+
87
+ with Full Tank
88
+ ✓ drive long distance
89
+
90
+ without Fuel
91
+ ✓ cannot start engine
92
+
93
+ when the Engine is Running
94
+ ✓ consumes fuel
95
+ ```
96
+
97
+ ### Available Prefixes
98
+
99
+ **pytest-pyspec** supports three types of prefixes to create semantic test hierarchies:
100
+
101
+ #### 1. Object Classes (use `describe` or `test`)
102
+
103
+ Define what you're testing:
104
+
105
+ ```python
106
+ class DescribeCar: # or class TestCar:
107
+ def test_has_four_wheels(self):
108
+ assert True
109
+ ```
110
+
111
+ Output:
112
+ ```
113
+ a Car
114
+ ✓ has four wheels
115
+ ```
116
+
117
+ #### 2. Context Classes (use `with`, `without`, or `when`)
118
+
119
+ Define the context or state:
120
+
121
+ ```python
122
+ class DescribeCar:
123
+ class WithFullTank:
124
+ def test_can_drive_long_distances(self):
125
+ assert True
126
+
127
+ class WithoutFuel:
128
+ def test_cannot_start_engine(self):
129
+ assert True
130
+
131
+ class WhenTheEngineIsRunning:
132
+ def test_consumes_fuel(self):
133
+ assert True
134
+ ```
135
+
136
+ Output:
137
+ ```
138
+ a Car
139
+ with Full Tank
140
+ ✓ can drive long distances
141
+
142
+ without Fuel
143
+ ✓ cannot start engine
144
+
145
+ when the Engine is Running
146
+ ✓ consumes fuel
147
+ ```
148
+
149
+ #### 3. Test Functions (use `it_` or `test_`)
150
+
151
+ Define the expected behavior:
152
+
153
+ ```python
154
+ class DescribeCar:
155
+ def it_has_four_wheels(self):
156
+ assert True
157
+
158
+ def test_has_engine(self):
159
+ assert True
160
+ ```
161
+
162
+ Output:
163
+ ```
164
+ a Car
165
+ ✓ has four wheels
166
+ ✓ has engine
167
+ ```
168
+
169
+ ### Using Docstrings
170
+
171
+ Override automatic naming with custom descriptions:
172
+
173
+ ```python
174
+ class TestCar:
175
+ """sports car"""
176
+
177
+ def test_top_speed(self):
178
+ """reaches 200 mph"""
179
+ assert True
180
+
181
+ class WhenTheNitroIsActivated:
182
+ """when nitro boost is activated"""
183
+
184
+ def test_acceleration(self):
185
+ """accelerates rapidly"""
186
+ assert True
187
+ ```
188
+
189
+ Output:
190
+ ```
191
+ a sports car
192
+ ✓ reaches 200 mph
193
+
194
+ when nitro boost is activated
195
+ ✓ accelerates rapidly
196
+ ```
197
+
198
+ ## Configuration
199
+
200
+ The plugin is automatically enabled when you use the `--pyspec` flag. No additional configuration is required.
201
+
202
+ For more information, see the [documentation](https://github.com/felipecrp/pytest-pyspec/blob/main/doc/README.md).
@@ -0,0 +1,174 @@
1
+ [![](https://github.com/felipecrp/pytest-pyspec/actions/workflows/pytest.yml/badge.svg)](https://github.com/felipecrp/pytest-pyspec/actions/workflows/pytest.yml)
2
+
3
+ # pytest-pyspec
4
+
5
+ The **pytest-pyspec** plugin transforms pytest output into a beautiful, readable format similar to RSpec. It provides semantic meaning to your tests by organizing them into descriptive hierarchies.
6
+
7
+ ## Features
8
+
9
+ - **Semantic Output**: Transform pytest's default output into readable, hierarchical descriptions
10
+ - **Multiple Prefixes**: Support for `describe/test` (objects), `with/without/when` (contexts), and `it/test` (tests)
11
+ - **Docstring Support**: Override test descriptions using docstrings
12
+ - **Consolidated Output**: Smart grouping that avoids repeating parent headers
13
+ - **Natural Language**: Automatic lowercase formatting of common words (the, is, are, etc.)
14
+
15
+ ## Quick Start
16
+
17
+ ### Installation
18
+
19
+ ```bash
20
+ pip install pytest pytest-pyspec
21
+ ```
22
+
23
+ ### Running
24
+
25
+ ```bash
26
+ pytest --pyspec
27
+ ```
28
+
29
+ ## Examples
30
+
31
+ ### Car Scenario
32
+
33
+ A minimal car example with properties and behaviors:
34
+
35
+ ```python
36
+ class DescribeCar:
37
+ def test_has_engine(self):
38
+ assert True
39
+
40
+ class WithFullTank:
41
+ def test_drive_long_distance(self):
42
+ assert True
43
+
44
+ class WithoutFuel:
45
+ def test_cannot_start_engine(self):
46
+ assert True
47
+
48
+ class WhenTheEngineIsRunning:
49
+ def test_consumes_fuel(self):
50
+ assert True
51
+ ```
52
+
53
+ With **pytest-pyspec**, this produces:
54
+
55
+ ```
56
+ a Car
57
+ ✓ has engine
58
+
59
+ with Full Tank
60
+ ✓ drive long distance
61
+
62
+ without Fuel
63
+ ✓ cannot start engine
64
+
65
+ when the Engine is Running
66
+ ✓ consumes fuel
67
+ ```
68
+
69
+ ### Available Prefixes
70
+
71
+ **pytest-pyspec** supports three types of prefixes to create semantic test hierarchies:
72
+
73
+ #### 1. Object Classes (use `describe` or `test`)
74
+
75
+ Define what you're testing:
76
+
77
+ ```python
78
+ class DescribeCar: # or class TestCar:
79
+ def test_has_four_wheels(self):
80
+ assert True
81
+ ```
82
+
83
+ Output:
84
+ ```
85
+ a Car
86
+ ✓ has four wheels
87
+ ```
88
+
89
+ #### 2. Context Classes (use `with`, `without`, or `when`)
90
+
91
+ Define the context or state:
92
+
93
+ ```python
94
+ class DescribeCar:
95
+ class WithFullTank:
96
+ def test_can_drive_long_distances(self):
97
+ assert True
98
+
99
+ class WithoutFuel:
100
+ def test_cannot_start_engine(self):
101
+ assert True
102
+
103
+ class WhenTheEngineIsRunning:
104
+ def test_consumes_fuel(self):
105
+ assert True
106
+ ```
107
+
108
+ Output:
109
+ ```
110
+ a Car
111
+ with Full Tank
112
+ ✓ can drive long distances
113
+
114
+ without Fuel
115
+ ✓ cannot start engine
116
+
117
+ when the Engine is Running
118
+ ✓ consumes fuel
119
+ ```
120
+
121
+ #### 3. Test Functions (use `it_` or `test_`)
122
+
123
+ Define the expected behavior:
124
+
125
+ ```python
126
+ class DescribeCar:
127
+ def it_has_four_wheels(self):
128
+ assert True
129
+
130
+ def test_has_engine(self):
131
+ assert True
132
+ ```
133
+
134
+ Output:
135
+ ```
136
+ a Car
137
+ ✓ has four wheels
138
+ ✓ has engine
139
+ ```
140
+
141
+ ### Using Docstrings
142
+
143
+ Override automatic naming with custom descriptions:
144
+
145
+ ```python
146
+ class TestCar:
147
+ """sports car"""
148
+
149
+ def test_top_speed(self):
150
+ """reaches 200 mph"""
151
+ assert True
152
+
153
+ class WhenTheNitroIsActivated:
154
+ """when nitro boost is activated"""
155
+
156
+ def test_acceleration(self):
157
+ """accelerates rapidly"""
158
+ assert True
159
+ ```
160
+
161
+ Output:
162
+ ```
163
+ a sports car
164
+ ✓ reaches 200 mph
165
+
166
+ when nitro boost is activated
167
+ ✓ accelerates rapidly
168
+ ```
169
+
170
+ ## Configuration
171
+
172
+ The plugin is automatically enabled when you use the `--pyspec` flag. No additional configuration is required.
173
+
174
+ For more information, see the [documentation](https://github.com/felipecrp/pytest-pyspec/blob/main/doc/README.md).
@@ -0,0 +1,53 @@
1
+ [project]
2
+ name = "pytest-pyspec"
3
+ version = "1.0.0"
4
+ description = 'A plugin that transforms the pytest output into a result similar to the RSpec. It enables the use of docstrings to display results and also enables the use of the prefixes "describe", "with" and "it".'
5
+ authors = [{ name = "Felipe Curty", email = "felipecrp@gmail.com" }]
6
+ requires-python = ">=3.10, <4"
7
+ readme = "README.md"
8
+ license = "MIT"
9
+ dependencies = [
10
+ "pytest>=9,<10",
11
+ ]
12
+
13
+ classifiers = [
14
+ "Development Status :: 5 - Production/Stable",
15
+ "Intended Audience :: Developers",
16
+ "Operating System :: MacOS",
17
+ "Operating System :: Microsoft :: Windows",
18
+ "Operating System :: POSIX",
19
+ "Operating System :: Unix",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Topic :: Software Development :: Libraries",
27
+ "Topic :: Software Development :: Testing",
28
+ "Topic :: Utilities",
29
+ ]
30
+
31
+ [project.urls]
32
+ Repository = "https://github.com/felipecrp/pytest-pyspec"
33
+ Issues = "https://github.com/felipecrp/pytest-pyspec/issues"
34
+
35
+ [project.entry-points.pytest11]
36
+ pytest_pyspec = "pytest_pyspec.plugin"
37
+
38
+ [dependency-groups]
39
+ dev = ["autopep8>=2.0.2,<3"]
40
+
41
+ [tool.hatch.build.targets.sdist]
42
+ include = ["pytest_pyspec"]
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ include = ["pytest_pyspec"]
46
+
47
+ [build-system]
48
+ requires = ["hatchling"]
49
+ build-backend = "hatchling.build"
50
+
51
+ [tool.pytest.ini_options]
52
+ addopts = "--pyspec"
53
+