pytest-autofixture 0.2.1__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.
@@ -0,0 +1,5 @@
1
+ 0.2.1, 2024-08-01
2
+ - fix build
3
+ 0.2.0, 2024-08-01
4
+ - rename and readme
5
+ 0.1.0, 2024-07-23
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Daniel Pepper
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,2 @@
1
+ include *.txt
2
+ recursive-include docs *.txt
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.1
2
+ Name: pytest-autofixture
3
+ Version: 0.2.1
4
+ Summary: simplify pytest fixtures
5
+ Author: Daniel Pepper
6
+ License: The MIT License (MIT)
7
+
8
+ Copyright (c) 2024 Daniel Pepper
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/dpep/pytest-autofixture
29
+ Classifier: Framework :: Pytest
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Topic :: Software Development :: Testing
32
+ Requires-Python: >=3
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE.txt
35
+ Requires-Dist: pytest>=8
36
+ Provides-Extra: test
37
+ Requires-Dist: isort>=5.13; extra == "test"
38
+ Requires-Dist: setuptools>=61; extra == "test"
39
+
40
+ pytest-autofixture
41
+ ======
42
+ Simplify pytest fixtures by making them automagically available. Tests can reference fixtures without needing to reference them as function parameters.
43
+
44
+
45
+ ### Install
46
+ ```pip install pytest-autofixture```
47
+
48
+
49
+ ### Usage
50
+ ```python
51
+ # conftest.py
52
+ import pytest
53
+
54
+ @pytest.fixture
55
+ def one():
56
+ return 1
57
+
58
+
59
+ # test_one.py
60
+ def test_one():
61
+ assert one == 1
62
+ ```
63
+
64
+ ----
65
+ [![Coverage Status](https://coveralls.io/repos/github/dpep/pytest-autofixture/badge.svg?branch=main)](https://coveralls.io/github/dpep/pytest-autofixture?branch=main)
66
+ [![installs](https://img.shields.io/pypi/dm/pytest-autofixture?label=installs)](https://pypi.org/project/pytest-autofixture)
@@ -0,0 +1,27 @@
1
+ pytest-autofixture
2
+ ======
3
+ Simplify pytest fixtures by making them automagically available. Tests can reference fixtures without needing to reference them as function parameters.
4
+
5
+
6
+ ### Install
7
+ ```pip install pytest-autofixture```
8
+
9
+
10
+ ### Usage
11
+ ```python
12
+ # conftest.py
13
+ import pytest
14
+
15
+ @pytest.fixture
16
+ def one():
17
+ return 1
18
+
19
+
20
+ # test_one.py
21
+ def test_one():
22
+ assert one == 1
23
+ ```
24
+
25
+ ----
26
+ [![Coverage Status](https://coveralls.io/repos/github/dpep/pytest-autofixture/badge.svg?branch=main)](https://coveralls.io/github/dpep/pytest-autofixture?branch=main)
27
+ [![installs](https://img.shields.io/pypi/dm/pytest-autofixture?label=installs)](https://pypi.org/project/pytest-autofixture)
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pytest-autofixture"
7
+ authors = [{name = "Daniel Pepper"}]
8
+ dynamic = ["version"]
9
+ description = "simplify pytest fixtures"
10
+ readme = "README.md"
11
+ license = {file = "LICENSE.txt"}
12
+ classifiers = [
13
+ # https://pypi.python.org/pypi?%3Aaction=list_classifiers
14
+ "Framework :: Pytest",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Topic :: Software Development :: Testing"
17
+ ]
18
+ requires-python = ">= 3"
19
+ dependencies = ["pytest >= 8"]
20
+
21
+ [project.entry-points.pytest11]
22
+ autofixture = "pytest_autofixture"
23
+
24
+ [project.optional-dependencies]
25
+ test = [
26
+ "isort >= 5.13",
27
+ "setuptools >= 61",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/dpep/pytest-autofixture"
32
+
33
+ [tool.setuptools]
34
+ packages = ["pytest_autofixture"]
35
+
36
+ [tool.setuptools.dynamic]
37
+ version = {attr = "pytest_autofixture.__version__"}
@@ -0,0 +1,22 @@
1
+ __author__ = 'dpepper'
2
+ __version__ = '0.2.1'
3
+
4
+
5
+ def pytest_runtest_call(item):
6
+ req = item._request
7
+ manager = item.session._fixturemanager
8
+ fixtures = item.session._fixturemanager._arg2fixturedefs.keys()
9
+
10
+ # find missing references
11
+ refs = item.obj.__code__.co_names & fixtures
12
+
13
+ for ref in refs:
14
+ # if a different reference is already in scope, skip
15
+ global_ref = item.function.__globals__.get(ref)
16
+ if global_ref and not hasattr(global_ref, '_pytestfixturefunction'):
17
+ continue
18
+
19
+ fixture = manager.getfixturedefs(ref, item)[0]
20
+ res = item.ihook.pytest_fixture_setup(fixturedef=fixture, request=req)
21
+
22
+ item.function.__globals__[ref] = res
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.1
2
+ Name: pytest-autofixture
3
+ Version: 0.2.1
4
+ Summary: simplify pytest fixtures
5
+ Author: Daniel Pepper
6
+ License: The MIT License (MIT)
7
+
8
+ Copyright (c) 2024 Daniel Pepper
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/dpep/pytest-autofixture
29
+ Classifier: Framework :: Pytest
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Topic :: Software Development :: Testing
32
+ Requires-Python: >=3
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE.txt
35
+ Requires-Dist: pytest>=8
36
+ Provides-Extra: test
37
+ Requires-Dist: isort>=5.13; extra == "test"
38
+ Requires-Dist: setuptools>=61; extra == "test"
39
+
40
+ pytest-autofixture
41
+ ======
42
+ Simplify pytest fixtures by making them automagically available. Tests can reference fixtures without needing to reference them as function parameters.
43
+
44
+
45
+ ### Install
46
+ ```pip install pytest-autofixture```
47
+
48
+
49
+ ### Usage
50
+ ```python
51
+ # conftest.py
52
+ import pytest
53
+
54
+ @pytest.fixture
55
+ def one():
56
+ return 1
57
+
58
+
59
+ # test_one.py
60
+ def test_one():
61
+ assert one == 1
62
+ ```
63
+
64
+ ----
65
+ [![Coverage Status](https://coveralls.io/repos/github/dpep/pytest-autofixture/badge.svg?branch=main)](https://coveralls.io/github/dpep/pytest-autofixture?branch=main)
66
+ [![installs](https://img.shields.io/pypi/dm/pytest-autofixture?label=installs)](https://pypi.org/project/pytest-autofixture)
@@ -0,0 +1,14 @@
1
+ CHANGES.txt
2
+ LICENSE.txt
3
+ MANIFEST.in
4
+ README.md
5
+ pyproject.toml
6
+ setup.py
7
+ pytest_autofixture/__init__.py
8
+ pytest_autofixture.egg-info/PKG-INFO
9
+ pytest_autofixture.egg-info/SOURCES.txt
10
+ pytest_autofixture.egg-info/dependency_links.txt
11
+ pytest_autofixture.egg-info/entry_points.txt
12
+ pytest_autofixture.egg-info/requires.txt
13
+ pytest_autofixture.egg-info/top_level.txt
14
+ tests/test_basic.py
@@ -0,0 +1,2 @@
1
+ [pytest11]
2
+ autofixture = pytest_autofixture
@@ -0,0 +1,5 @@
1
+ pytest>=8
2
+
3
+ [test]
4
+ isort>=5.13
5
+ setuptools>=61
@@ -0,0 +1 @@
1
+ pytest_autofixture
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env python
2
+ from setuptools import setup
3
+
4
+ setup()
@@ -0,0 +1,30 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.fixture
5
+ def one():
6
+ return 1
7
+
8
+
9
+ @pytest.fixture
10
+ def two():
11
+ return 2
12
+
13
+
14
+ @pytest.fixture
15
+ def three(one, two):
16
+ return one + two
17
+
18
+
19
+ def test_explicit(one):
20
+ assert one == 1
21
+
22
+
23
+ def test_implicit():
24
+ assert one == 1
25
+
26
+
27
+ def test_three():
28
+ assert one == 1
29
+ assert two == 2
30
+ assert three == 3