pytest-plugins 0.1.26__tar.gz → 0.2.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 (30) hide show
  1. {pytest_plugins-0.1.26/pytest_plugins.egg-info → pytest_plugins-0.2.0}/PKG-INFO +3 -2
  2. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/README.md +1 -0
  3. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/better_report.py +15 -1
  4. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/models/test_data.py +1 -0
  5. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/utils/create_report.py +1 -2
  6. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/utils/pytest_helper.py +5 -0
  7. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0/pytest_plugins.egg-info}/PKG-INFO +3 -2
  8. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins.egg-info/requires.txt +1 -1
  9. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/requirements.txt +1 -1
  10. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/setup.py +1 -1
  11. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/tests/test_dummy.py +6 -2
  12. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/LICENSE +0 -0
  13. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/MANIFEST.in +0 -0
  14. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pyproject.toml +0 -0
  15. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/__init__.py +0 -0
  16. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/add_config_parameters.py +0 -0
  17. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/fail2skip.py +0 -0
  18. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/max_fail_streak.py +0 -0
  19. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/models/__init__.py +0 -0
  20. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/models/base_class_test.py +0 -0
  21. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/models/environment_data.py +0 -0
  22. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/models/execution_data.py +0 -0
  23. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/models/status.py +0 -0
  24. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/utils/__init__.py +0 -0
  25. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins/utils/helper.py +0 -0
  26. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins.egg-info/SOURCES.txt +0 -0
  27. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins.egg-info/dependency_links.txt +0 -0
  28. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins.egg-info/entry_points.txt +0 -0
  29. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/pytest_plugins.egg-info/top_level.txt +0 -0
  30. {pytest_plugins-0.1.26 → pytest_plugins-0.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-plugins
3
- Version: 0.1.26
3
+ Version: 0.2.0
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Home-page: https://github.com/aviz92/pytest-plugins
6
6
  Author: Avi Zaguri
@@ -17,7 +17,7 @@ Requires-Dist: dotenv
17
17
  Requires-Dist: colorlog
18
18
  Requires-Dist: pytest
19
19
  Requires-Dist: pytest-rerunfailures
20
- Requires-Dist: custom_python_logger
20
+ Requires-Dist: custom-python-logger
21
21
  Dynamic: author
22
22
  Dynamic: classifier
23
23
  Dynamic: description
@@ -46,6 +46,7 @@ generate `execution_results.json`, `test_results.json`, and `test_report`.md und
46
46
  - `--mr-number`: Include a merge request number in the report for better traceability.
47
47
  - `--add-parameters`: Add the test parameters as fields to the test results.
48
48
  - `--pytest-command`: Add the detailed information about the pytest command-line to the "execution_results.json" file
49
+ - `--verbose-param-ids`: Include parameter names in pytest test IDs (e.g., `test_name[param1: value1, param2: value2]` instead of `test_name[param1-param2])`
49
50
  <br> <br>
50
51
  - ✅ **maxfail-streak**: Stop test execution after a configurable number of consecutive failures.
51
52
  - flags:
@@ -15,6 +15,7 @@ generate `execution_results.json`, `test_results.json`, and `test_report`.md und
15
15
  - `--mr-number`: Include a merge request number in the report for better traceability.
16
16
  - `--add-parameters`: Add the test parameters as fields to the test results.
17
17
  - `--pytest-command`: Add the detailed information about the pytest command-line to the "execution_results.json" file
18
+ - `--verbose-param-ids`: Include parameter names in pytest test IDs (e.g., `test_name[param1: value1, param2: value2]` instead of `test_name[param1-param2])`
18
19
  <br> <br>
19
20
  - ✅ **maxfail-streak**: Stop test execution after a configurable number of consecutive failures.
20
21
  - flags:
@@ -15,7 +15,12 @@ from _pytest.python import Function
15
15
  from pytest_plugins.models.environment_data import EnvironmentData
16
16
  from pytest_plugins.utils.helper import save_as_json, serialize_data, save_as_markdown
17
17
  from pytest_plugins.models import ExecutionData, ExecutionStatus, TestData
18
- from pytest_plugins.utils.pytest_helper import get_test_full_name, get_test_name_without_parameters, get_test_full_path
18
+ from pytest_plugins.utils.pytest_helper import (
19
+ get_test_full_name,
20
+ get_test_name_without_parameters,
21
+ get_test_full_path,
22
+ get_pytest_test_name
23
+ )
19
24
  from pytest_plugins.utils.create_report import generate_md_report
20
25
 
21
26
  execution_results = {}
@@ -68,6 +73,12 @@ def pytest_addoption(parser: Parser) -> None:
68
73
  default=None,
69
74
  help='Add the detailed information about the pytest command-line to the "execution_results.json" file'
70
75
  )
76
+ parser.addoption(
77
+ "--verbose-param-ids",
78
+ action="store_true",
79
+ default=None,
80
+ help="Include parameter names in pytest test IDs (e.g., test_name[param1=value1,param2=value2] instead of test_name[param1,value1,param2,value2])"
81
+ )
71
82
 
72
83
 
73
84
  def pytest_configure(config: Config) -> None:
@@ -117,6 +128,7 @@ def pytest_collection_modifyitems(config: Config, items: list[Function]) -> None
117
128
  test_results[test_full_name] = TestData(
118
129
  class_test_name=item.cls.__name__ if item.cls else None,
119
130
  test_name=test_name,
131
+ pytest_test_name=get_pytest_test_name(item=item),
120
132
  test_full_name=test_full_name,
121
133
  test_full_path=get_test_full_path(item=item),
122
134
  test_file_name=item.fspath.basename,
@@ -128,6 +140,8 @@ def pytest_collection_modifyitems(config: Config, items: list[Function]) -> None
128
140
  )
129
141
  if getattr(item, 'callspec', None) and config.getoption('--add-parameters'):
130
142
  test_results[test_full_name].__dict__.update(**item.callspec.params)
143
+ if config.getoption('--verbose-param-ids'):
144
+ item._nodeid = f"{item.fspath.basename}::{test_full_name}"
131
145
  logger.debug(f'Tests to be executed: \n{json.dumps(list(test_results.keys()), indent=4, default=serialize_data)}')
132
146
  time.sleep(0.3) # Sleep to ensure the debug log is printed before the tests start
133
147
 
@@ -9,6 +9,7 @@ class TestData:
9
9
  test_file_name: str
10
10
  class_test_name: str
11
11
  test_name: str
12
+ pytest_test_name: str
12
13
  test_full_name: str
13
14
  test_full_path: str
14
15
  test_status: ExecutionStatus = ExecutionStatus.COLLECTED
@@ -24,10 +24,9 @@ def generate_md_report(report: dict) -> str:
24
24
  )
25
25
  rows.append(f"|{index}| `{name}` | {icon} {status} | {duration} | `{msg}` |")
26
26
 
27
- summary = f"\n🧪 Total: {len(report)} | " + " | ".join(['','',''])
28
27
  total_summary = f"\n🧪 Total: {len(report)} &nbsp;&nbsp;| &nbsp;&nbsp;" + " &nbsp;&nbsp;| &nbsp;&nbsp;".join(
29
28
  f"{icon} {k.capitalize()}: {v}" for k, v in stats.items()
30
29
  for icon in [status_icons.get(k, "")]
31
30
  )
32
31
 
33
- return "## ✅ Test Report Summary\n\n" + "\n".join(rows) + summary + f'\n<br> \n\n### Summary: <br> \n{total_summary}'
32
+ return "## ✅ Test Report Summary\n\n" + "\n".join(rows) + f'\n<br> \n\n### Summary: <br> \n{total_summary}'
@@ -15,6 +15,11 @@ def get_test_name_without_parameters(item: Function) -> str:
15
15
  return item.nodeid.split('.py::')[-1].split('[')[0]
16
16
 
17
17
 
18
+ def get_pytest_test_name(item: Function) -> str:
19
+ """Get the test name without parameters."""
20
+ return item.nodeid.split('.py::')[-1]
21
+
22
+
18
23
  def get_test_full_name(item: Function) -> str:
19
24
  """Get the full name of the test, including parameters if available."""
20
25
  test_name = get_test_name_without_parameters(item=item)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-plugins
3
- Version: 0.1.26
3
+ Version: 0.2.0
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Home-page: https://github.com/aviz92/pytest-plugins
6
6
  Author: Avi Zaguri
@@ -17,7 +17,7 @@ Requires-Dist: dotenv
17
17
  Requires-Dist: colorlog
18
18
  Requires-Dist: pytest
19
19
  Requires-Dist: pytest-rerunfailures
20
- Requires-Dist: custom_python_logger
20
+ Requires-Dist: custom-python-logger
21
21
  Dynamic: author
22
22
  Dynamic: classifier
23
23
  Dynamic: description
@@ -46,6 +46,7 @@ generate `execution_results.json`, `test_results.json`, and `test_report`.md und
46
46
  - `--mr-number`: Include a merge request number in the report for better traceability.
47
47
  - `--add-parameters`: Add the test parameters as fields to the test results.
48
48
  - `--pytest-command`: Add the detailed information about the pytest command-line to the "execution_results.json" file
49
+ - `--verbose-param-ids`: Include parameter names in pytest test IDs (e.g., `test_name[param1: value1, param2: value2]` instead of `test_name[param1-param2])`
49
50
  <br> <br>
50
51
  - ✅ **maxfail-streak**: Stop test execution after a configurable number of consecutive failures.
51
52
  - flags:
@@ -4,4 +4,4 @@ dotenv
4
4
  colorlog
5
5
  pytest
6
6
  pytest-rerunfailures
7
- custom_python_logger
7
+ custom-python-logger
@@ -4,4 +4,4 @@ dotenv
4
4
  colorlog
5
5
  pytest
6
6
  pytest-rerunfailures
7
- custom_python_logger
7
+ custom-python-logger
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- package_version = '0.1.26'
3
+ package_version = '0.2.0'
4
4
 
5
5
  package_name = 'pytest-plugins'
6
6
  package_description = 'A Python package for managing pytest plugins.'
@@ -1,12 +1,16 @@
1
1
  import pytest
2
2
 
3
- parametrize = pytest.mark.parametrize("param1, param2", [("A", "A"), (2, 2), (3, 3), (4, 5)])
3
+ parametrize = pytest.mark.parametrize(
4
+ "param1, param2", [("A", "A"), (2, 2), (3, 3), (4, 5)]
5
+ )
6
+
4
7
 
5
8
  class TestDummy:
6
9
  @pytest.mark.test_pass
7
10
  def test_pass(self):
8
11
  assert True
9
12
 
13
+ @pytest.mark.test_fail
10
14
  def test_false(self):
11
15
  assert False, {"message": "This test is expected to fail."}
12
16
 
@@ -19,7 +23,7 @@ class TestDummy:
19
23
  assert param1 != param2, {
20
24
  "expected_value": param1,
21
25
  "actual_value": param2,
22
- "diagnostic_info": {"param1": param1, "param2": param2}
26
+ "diagnostic_info": {"param1": param1, "param2": param2},
23
27
  }
24
28
 
25
29
  @pytest.mark.parametrize("param1, param2", [(1, 1), (2, 2), (3, 3), (4, 5)])
File without changes