Skip to content

Commit

Permalink
README.md update plus better error handling for No Topic case. (#69)
Browse files Browse the repository at this point in the history
* Error handling for logic, when Issues have No Topic.
  • Loading branch information
MobiTikula authored Nov 19, 2024
1 parent 51b688b commit c3a2c57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ See the default action step definition:
"projects-title-filter": ["Community Outreach Initiatives", "CDD Project"]
}
]'
```
```
See the full example of action step definition (in example are used non-default values):
Expand Down Expand Up @@ -534,14 +534,14 @@ All done! ✨ 🍰 ✨
## Run Unit Test

Unit tests are written using Pytest framework. To run alle the tests, use the following command:
```bash
```shell
pytest tests/
```

You can modify the directory to control the level of detail or granularity as per your needs.

To run specific test, write the command following the pattern below:
```bash
```shell
pytest tests/utils/test_utils.py::test_make_issue_key
```

Expand All @@ -551,14 +551,14 @@ This project uses [pytest-cov](https://pypi.org/project/pytest-cov/) plugin to g
The objective of the project is to achieve a minimal score of 80 %. We do exclude the `tests/` file from the coverage report.

To generate the coverage report, run the following command:
```bash
```shell
pytest --cov=. tests/ --cov-fail-under=80 --cov-report=html
```

See the coverage report on the path:

```
htmlcov/index.html
```shell
open htmlcov/index.html
```

## Deployment
Expand Down
1 change: 1 addition & 0 deletions living_documentation_generator/model/consolidated_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def generate_directory_path(self, issue_table: str) -> list[str]:
# If no label ends with "Topic", create a "NoTopic" issue directory path
if not topic_labels:
self.__topics = ["NoTopic"]
logger.error("No Topic label found for Issue #%i: %s (%s)", self.number, self.title, self.repository_id)
no_topic_path = os.path.join(output_path, "NoTopic")
return [no_topic_path]

Expand Down
4 changes: 4 additions & 0 deletions tests/model/test_consolidated_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def test_generate_directory_path_structured_output_disabled_grouping_by_topics_e


def test_generate_directory_path_structured_output_disabled_grouping_by_topics_enabled_no_issue_topics(mocker):
mock_log_error = mocker.patch("living_documentation_generator.model.consolidated_issue.logger.error")
mock_log_debug = mocker.patch("living_documentation_generator.model.consolidated_issue.logger.debug")
mocker.patch(
"living_documentation_generator.action_inputs.ActionInputs.get_output_directory",
Expand All @@ -135,6 +136,9 @@ def test_generate_directory_path_structured_output_disabled_grouping_by_topics_e
actual = consolidated_issue.generate_directory_path("| Labels | feature, bug |")

assert ["/base/output/path/NoTopic"] == actual
mock_log_error.assert_called_once_with(
"No Topic label found for Issue #%i: %s (%s)", 1, "Issue Title", "organization/repository"
)
mock_log_debug.assert_not_called()


Expand Down

0 comments on commit c3a2c57

Please sign in to comment.