pytest-plugins 0.1.0__tar.gz → 0.1.2__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 (28) hide show
  1. pytest_plugins-0.1.2/PKG-INFO +79 -0
  2. pytest_plugins-0.1.2/README.md +48 -0
  3. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/add_better_report.py +5 -8
  4. pytest_plugins-0.1.2/pytest_plugins/fail2skip.py +44 -0
  5. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/max_fail_streak.py +7 -10
  6. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/models/status.py +1 -0
  7. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/pytest_helper.py +6 -0
  8. pytest_plugins-0.1.2/pytest_plugins.egg-info/PKG-INFO +79 -0
  9. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins.egg-info/SOURCES.txt +1 -0
  10. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins.egg-info/entry_points.txt +1 -0
  11. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/setup.py +3 -2
  12. pytest_plugins-0.1.0/PKG-INFO +0 -32
  13. pytest_plugins-0.1.0/README.md +0 -1
  14. pytest_plugins-0.1.0/pytest_plugins.egg-info/PKG-INFO +0 -32
  15. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/LICENSE +0 -0
  16. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/MANIFEST.in +0 -0
  17. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pyproject.toml +0 -0
  18. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/__init__.py +0 -0
  19. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/helper.py +0 -0
  20. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/models/__init__.py +0 -0
  21. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/models/base_class_test.py +0 -0
  22. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/models/execution_data.py +0 -0
  23. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins/models/test_data.py +0 -0
  24. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins.egg-info/dependency_links.txt +0 -0
  25. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins.egg-info/requires.txt +0 -0
  26. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/pytest_plugins.egg-info/top_level.txt +0 -0
  27. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/requirements.txt +0 -0
  28. {pytest_plugins-0.1.0 → pytest_plugins-0.1.2}/setup.cfg +0 -0
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-plugins
3
+ Version: 0.1.2
4
+ Summary: A Python package for managing pytest plugins.
5
+ Home-page: https://github.com/aviz92/pytest-plugins
6
+ Author: Avi Zaguri
7
+ Author-email:
8
+ Project-URL: Repository, https://github.com/aviz92/pytest-plugins
9
+ Classifier: Framework :: Pytest
10
+ Classifier: Programming Language :: Python
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: setuptools
15
+ Requires-Dist: wheel
16
+ Requires-Dist: dotenv
17
+ Requires-Dist: colorlog
18
+ Requires-Dist: pytest
19
+ Requires-Dist: pytest-rerunfailures
20
+ Requires-Dist: custom_python_logger
21
+ Dynamic: author
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: license-file
27
+ Dynamic: project-url
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
31
+
32
+ # pytest-plugins
33
+ An advanced pytest plugin designed for Python projects, offering robust features and utilities to enhance the testing workflow. <br>
34
+ It includes improved `conftest.py` fixtures, automated test result reporting, detailed logging, and seamless integration with external tools for a streamlined and efficient testing experience.
35
+
36
+ ---
37
+
38
+ ## Features
39
+ - ✅ **`pytest-better-report`**: Enhanced test result tracking and structured JSON reporting.
40
+ - ✅ **`pytest-maxfail-streak`**: Stop test execution after a configurable number of consecutive failures.
41
+
42
+ ---
43
+
44
+ ### 🔧 Usage
45
+ - pytest-better-report
46
+ - pytest --better-report-enable
47
+ - pytest --better-report-enable --pr-number=123
48
+ - pytest-maxfail-streak
49
+ - pytest --maxfail-streak-enable --maxfail-streak=3
50
+
51
+ or use the `pytest.ini` configuration file to set default values for these plugins.
52
+
53
+ ```ini
54
+ [pytest]
55
+ addopts = --better-report-enable --maxfail-streak-enable --maxfail-streak=3
56
+ ```
57
+
58
+ or
59
+
60
+ ```ini
61
+ [pytest]
62
+ addopts = --better-report-enable --pr-number=123 --maxfail-streak-enable --maxfail-streak=3
63
+ ```
64
+
65
+
66
+ ---
67
+
68
+ ## 🤝 Contributing
69
+ If you have a helpful tool, pattern, or improvement to suggest:
70
+ Fork the repo <br>
71
+ Create a new branch <br>
72
+ Submit a pull request <br>
73
+ I welcome additions that promote clean, productive, and maintainable development. <br>
74
+
75
+ ---
76
+
77
+ ## 🙏 Thanks
78
+ Thanks for exploring this repository! <br>
79
+ Happy coding! <br>
@@ -0,0 +1,48 @@
1
+ # pytest-plugins
2
+ An advanced pytest plugin designed for Python projects, offering robust features and utilities to enhance the testing workflow. <br>
3
+ It includes improved `conftest.py` fixtures, automated test result reporting, detailed logging, and seamless integration with external tools for a streamlined and efficient testing experience.
4
+
5
+ ---
6
+
7
+ ## Features
8
+ - ✅ **`pytest-better-report`**: Enhanced test result tracking and structured JSON reporting.
9
+ - ✅ **`pytest-maxfail-streak`**: Stop test execution after a configurable number of consecutive failures.
10
+
11
+ ---
12
+
13
+ ### 🔧 Usage
14
+ - pytest-better-report
15
+ - pytest --better-report-enable
16
+ - pytest --better-report-enable --pr-number=123
17
+ - pytest-maxfail-streak
18
+ - pytest --maxfail-streak-enable --maxfail-streak=3
19
+
20
+ or use the `pytest.ini` configuration file to set default values for these plugins.
21
+
22
+ ```ini
23
+ [pytest]
24
+ addopts = --better-report-enable --maxfail-streak-enable --maxfail-streak=3
25
+ ```
26
+
27
+ or
28
+
29
+ ```ini
30
+ [pytest]
31
+ addopts = --better-report-enable --pr-number=123 --maxfail-streak-enable --maxfail-streak=3
32
+ ```
33
+
34
+
35
+ ---
36
+
37
+ ## 🤝 Contributing
38
+ If you have a helpful tool, pattern, or improvement to suggest:
39
+ Fork the repo <br>
40
+ Create a new branch <br>
41
+ Submit a pull request <br>
42
+ I welcome additions that promote clean, productive, and maintainable development. <br>
43
+
44
+ ---
45
+
46
+ ## 🙏 Thanks
47
+ Thanks for exploring this repository! <br>
48
+ Happy coding! <br>
@@ -6,13 +6,14 @@ from pathlib import Path
6
6
  from typing import Any, Generator
7
7
 
8
8
  import pytest
9
+ from _pytest.config import Config, Parser
9
10
  from _pytest.fixtures import FixtureRequest
10
11
  from _pytest.main import Session
11
12
  from _pytest.python import Function
12
13
 
13
14
  from pytest_plugins.helper import save_as_json, serialize_data
14
15
  from pytest_plugins.models import ExecutionData, ExecutionStatus, TestData
15
- from pytest_plugins.pytest_helper import get_test_full_name, get_test_name_without_parameters
16
+ from pytest_plugins.pytest_helper import get_test_full_name, get_test_name_without_parameters, flag_is_enabled
16
17
 
17
18
  global_interface = {} # This variable is used to store the global interface object, if needed
18
19
  execution_results = {}
@@ -20,7 +21,7 @@ test_results = {}
20
21
  logger = logging.getLogger('pytest_plugins.add_better_report')
21
22
 
22
23
 
23
- def pytest_addoption(parser):
24
+ def pytest_addoption(parser: Parser):
24
25
  parser.addoption(
25
26
  "--better-report-enable",
26
27
  action="store_true",
@@ -35,12 +36,8 @@ def pytest_addoption(parser):
35
36
  )
36
37
 
37
38
 
38
- def _is_enabled(config):
39
- return config.getoption("--better-report-enable")
40
-
41
-
42
- def pytest_configure(config):
43
- if _is_enabled(config):
39
+ def pytest_configure(config: Config):
40
+ if flag_is_enabled(config=config, flag_name="--better-report-enable"):
44
41
  config._better_report_enabled = True
45
42
  else:
46
43
  config._better_report_enabled = False
@@ -0,0 +1,44 @@
1
+ import logging
2
+ import pytest
3
+ from _pytest.config import Config, Parser
4
+ from _pytest.reports import TestReport
5
+ from _pytest.outcomes import Skipped
6
+
7
+ from pytest_plugins.add_better_report import test_results
8
+ from pytest_plugins.models import ExecutionStatus
9
+ from pytest_plugins.pytest_helper import get_test_full_name, flag_is_enabled
10
+
11
+ logger = logging.getLogger("pytest_plugins.fail2skip")
12
+
13
+
14
+ def pytest_addoption(parser: Parser) -> None:
15
+ parser.addoption(
16
+ "--fail2skip-enable",
17
+ action="store_true",
18
+ default=False,
19
+ help="Enable converting failed tests marked with @pytest.mark.fail2skip into skipped.",
20
+ )
21
+
22
+
23
+ def pytest_configure(config: Config) -> None:
24
+ config.addinivalue_line(
25
+ "markers", "fail2skip: convert failed test to skip instead of fail"
26
+ )
27
+ config._fail2skip_enabled = config.getoption("--fail2skip-enable")
28
+
29
+
30
+ @pytest.hookimpl(hookwrapper=True)
31
+ def pytest_runtest_makereport(item, call):
32
+ outcome = yield
33
+ report = outcome.get_result()
34
+ if (
35
+ item.get_closest_marker("fail2skip")
36
+ and call.when == "call"
37
+ and report.outcome == "failed"
38
+ and item.config.getoption("--fail2skip-enable")
39
+ ):
40
+ report.outcome = "skipped"
41
+ report.longrepr = "fail2skip: forcibly skipped after failure"
42
+ report.wasxfail = "fail2skip"
43
+ test_results[get_test_full_name(item=item)].test_status = ExecutionStatus.FAILED_SKIPPED
44
+ return report
@@ -1,18 +1,19 @@
1
1
  import logging
2
2
  import pytest
3
- from _pytest.config import Parser
3
+ from _pytest.config import Config, Parser
4
4
  from _pytest.main import Session
5
5
  from _pytest.python import Function
6
+ from _pytest.reports import TestReport
6
7
 
7
8
  from pytest_plugins.add_better_report import test_results
8
9
  from pytest_plugins.models import ExecutionStatus
9
- from pytest_plugins.pytest_helper import get_test_full_name
10
+ from pytest_plugins.pytest_helper import get_test_full_name, flag_is_enabled
10
11
 
11
12
  logger = logging.getLogger('pytest_plugins.add_better_report')
12
13
  global_interface = {}
13
14
 
14
15
 
15
- def pytest_addoption(parser):
16
+ def pytest_addoption(parser: Parser):
16
17
  parser.addoption(
17
18
  "--maxfail-streak-enable",
18
19
  action="store_true",
@@ -27,12 +28,8 @@ def pytest_addoption(parser):
27
28
  ) # for using maxfail not streak, you can use the built-in pytest option `--maxfail`
28
29
 
29
30
 
30
- def _is_enabled(config) -> bool:
31
- return config.getoption("--maxfail-streak-enable")
32
-
33
-
34
- def pytest_configure(config):
35
- if _is_enabled(config):
31
+ def pytest_configure(config: Config):
32
+ if flag_is_enabled(config=config, flag_name="--maxfail-streak-enable"):
36
33
  config._max_fail_streak_enabled = True
37
34
  else:
38
35
  config._max_fail_streak_enabled = False
@@ -64,7 +61,7 @@ def pytest_runtest_setup(item: Function) -> None:
64
61
  logger.debug(f"Test class {item.cls.__name__} has parameter 'component' with value: {item.cls.component}")
65
62
 
66
63
 
67
- def pytest_runtest_logreport(report):
64
+ def pytest_runtest_logreport(report: TestReport):
68
65
  if report.when == "call":
69
66
  global_interface['fail_streak'] = global_interface['fail_streak'] + 1 if report.failed else 0
70
67
 
@@ -9,3 +9,4 @@ class ExecutionStatus(StrEnum):
9
9
  FAILED = "failed"
10
10
  CANCELLED = "cancelled"
11
11
  SKIPPED = "skipped"
12
+ FAILED_SKIPPED = "failed-skipped" # Force skipped, used in fail2skip plugin
@@ -1,9 +1,15 @@
1
1
  import logging
2
+
3
+ from _pytest.config import Config
2
4
  from _pytest.python import Function
3
5
 
4
6
  logger = logging.getLogger()
5
7
 
6
8
 
9
+ def flag_is_enabled(config: Config, flag_name: str) -> bool:
10
+ return config.getoption(flag_name)
11
+
12
+
7
13
  def get_test_name_without_parameters(item: Function) -> str:
8
14
  """Get the test name without parameters."""
9
15
  return item.nodeid.split('[')[0]
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-plugins
3
+ Version: 0.1.2
4
+ Summary: A Python package for managing pytest plugins.
5
+ Home-page: https://github.com/aviz92/pytest-plugins
6
+ Author: Avi Zaguri
7
+ Author-email:
8
+ Project-URL: Repository, https://github.com/aviz92/pytest-plugins
9
+ Classifier: Framework :: Pytest
10
+ Classifier: Programming Language :: Python
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: setuptools
15
+ Requires-Dist: wheel
16
+ Requires-Dist: dotenv
17
+ Requires-Dist: colorlog
18
+ Requires-Dist: pytest
19
+ Requires-Dist: pytest-rerunfailures
20
+ Requires-Dist: custom_python_logger
21
+ Dynamic: author
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: license-file
27
+ Dynamic: project-url
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
31
+
32
+ # pytest-plugins
33
+ An advanced pytest plugin designed for Python projects, offering robust features and utilities to enhance the testing workflow. <br>
34
+ It includes improved `conftest.py` fixtures, automated test result reporting, detailed logging, and seamless integration with external tools for a streamlined and efficient testing experience.
35
+
36
+ ---
37
+
38
+ ## Features
39
+ - ✅ **`pytest-better-report`**: Enhanced test result tracking and structured JSON reporting.
40
+ - ✅ **`pytest-maxfail-streak`**: Stop test execution after a configurable number of consecutive failures.
41
+
42
+ ---
43
+
44
+ ### 🔧 Usage
45
+ - pytest-better-report
46
+ - pytest --better-report-enable
47
+ - pytest --better-report-enable --pr-number=123
48
+ - pytest-maxfail-streak
49
+ - pytest --maxfail-streak-enable --maxfail-streak=3
50
+
51
+ or use the `pytest.ini` configuration file to set default values for these plugins.
52
+
53
+ ```ini
54
+ [pytest]
55
+ addopts = --better-report-enable --maxfail-streak-enable --maxfail-streak=3
56
+ ```
57
+
58
+ or
59
+
60
+ ```ini
61
+ [pytest]
62
+ addopts = --better-report-enable --pr-number=123 --maxfail-streak-enable --maxfail-streak=3
63
+ ```
64
+
65
+
66
+ ---
67
+
68
+ ## 🤝 Contributing
69
+ If you have a helpful tool, pattern, or improvement to suggest:
70
+ Fork the repo <br>
71
+ Create a new branch <br>
72
+ Submit a pull request <br>
73
+ I welcome additions that promote clean, productive, and maintainable development. <br>
74
+
75
+ ---
76
+
77
+ ## 🙏 Thanks
78
+ Thanks for exploring this repository! <br>
79
+ Happy coding! <br>
@@ -6,6 +6,7 @@ requirements.txt
6
6
  setup.py
7
7
  pytest_plugins/__init__.py
8
8
  pytest_plugins/add_better_report.py
9
+ pytest_plugins/fail2skip.py
9
10
  pytest_plugins/helper.py
10
11
  pytest_plugins/max_fail_streak.py
11
12
  pytest_plugins/pytest_helper.py
@@ -1,3 +1,4 @@
1
1
  [pytest11]
2
2
  better_report = pytest_plugins.add_better_report
3
+ fail2skip = pytest_plugins.fail2skip
3
4
  max_fail_streak = pytest_plugins.max_fail_streak
@@ -1,9 +1,9 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- package_version = '0.1.0'
3
+ package_version = '0.1.2'
4
4
 
5
5
  package_name = 'pytest-plugins'
6
- package_description = 'A Python package for managing plugins.'
6
+ package_description = 'A Python package for managing pytest plugins.'
7
7
 
8
8
  package_name_ = package_name.replace('-', '_')
9
9
  package_long_description_content_type = 'text/markdown'
@@ -37,6 +37,7 @@ setup(
37
37
  "pytest11": [
38
38
  "better_report = pytest_plugins.add_better_report",
39
39
  "max_fail_streak = pytest_plugins.max_fail_streak",
40
+ "fail2skip = pytest_plugins.fail2skip",
40
41
  ]
41
42
  },
42
43
  classifiers=[
@@ -1,32 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pytest-plugins
3
- Version: 0.1.0
4
- Summary: A Python package for managing plugins.
5
- Home-page: https://github.com/aviz92/pytest-plugins
6
- Author: Avi Zaguri
7
- Author-email:
8
- Project-URL: Repository, https://github.com/aviz92/pytest-plugins
9
- Classifier: Framework :: Pytest
10
- Classifier: Programming Language :: Python
11
- Requires-Python: >=3.11
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: setuptools
15
- Requires-Dist: wheel
16
- Requires-Dist: dotenv
17
- Requires-Dist: colorlog
18
- Requires-Dist: pytest
19
- Requires-Dist: pytest-rerunfailures
20
- Requires-Dist: custom_python_logger
21
- Dynamic: author
22
- Dynamic: classifier
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: home-page
26
- Dynamic: license-file
27
- Dynamic: project-url
28
- Dynamic: requires-dist
29
- Dynamic: requires-python
30
- Dynamic: summary
31
-
32
- # pytest-plugins
@@ -1 +0,0 @@
1
- # pytest-plugins
@@ -1,32 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pytest-plugins
3
- Version: 0.1.0
4
- Summary: A Python package for managing plugins.
5
- Home-page: https://github.com/aviz92/pytest-plugins
6
- Author: Avi Zaguri
7
- Author-email:
8
- Project-URL: Repository, https://github.com/aviz92/pytest-plugins
9
- Classifier: Framework :: Pytest
10
- Classifier: Programming Language :: Python
11
- Requires-Python: >=3.11
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: setuptools
15
- Requires-Dist: wheel
16
- Requires-Dist: dotenv
17
- Requires-Dist: colorlog
18
- Requires-Dist: pytest
19
- Requires-Dist: pytest-rerunfailures
20
- Requires-Dist: custom_python_logger
21
- Dynamic: author
22
- Dynamic: classifier
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: home-page
26
- Dynamic: license-file
27
- Dynamic: project-url
28
- Dynamic: requires-dist
29
- Dynamic: requires-python
30
- Dynamic: summary
31
-
32
- # pytest-plugins
File without changes
File without changes