Skip to content

Commit

Permalink
Make the project compatible with Towncrier >= 24.7
Browse files Browse the repository at this point in the history
Towncrier 24.7 changed the way that its `find_fragments()` function
works to accept a `Config` dataclass instead of specific components of
the config.

Co-Authored-By: Ben Rowland <ben.rowland@hallmarq.net>

Closes #94
Resolves #92
  • Loading branch information
webknjaz committed Dec 27, 2024
1 parent 7f57120 commit d60f568
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/sphinxcontrib/towncrier/_fragment_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,24 @@ def lookup_towncrier_fragments( # noqa: WPS210
else:
fragment_directory = None

_fragments, fragment_filenames = find_fragments(
str(fragment_base_directory),
towncrier_config.sections,
fragment_directory,
towncrier_config.types,
)
try:

Check warning on line 70 in src/sphinxcontrib/towncrier/_fragment_discovery.py

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L70

Added line #L70 was not covered by tests
# Towncrier < 24.7.0rc1
# pylint: disable-next=no-value-for-parameter,unexpected-keyword-arg
_fragments, fragment_filenames = find_fragments(

Check warning on line 73 in src/sphinxcontrib/towncrier/_fragment_discovery.py

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L73

Added line #L73 was not covered by tests
base_directory=str(fragment_base_directory),
sections=towncrier_config.sections,
fragment_directory=fragment_directory,
frag_type_names=towncrier_config.types,
orphan_prefix='+',
)
except TypeError:

Check warning on line 80 in src/sphinxcontrib/towncrier/_fragment_discovery.py

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L80

Added line #L80 was not covered by tests
# Towncrier >= 24.7.0rc1
_fragments, fragment_filenames = find_fragments( # noqa: WPS121

Check warning on line 82 in src/sphinxcontrib/towncrier/_fragment_discovery.py

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L82

Added line #L82 was not covered by tests
base_directory=str(fragment_base_directory),
config=towncrier_config,
strict=False,
)

return {Path(fname[0]) for fname in fragment_filenames}

Check warning on line 88 in src/sphinxcontrib/towncrier/_fragment_discovery.py

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L88

Added line #L88 was not covered by tests

return set(fragment_filenames)

0 comments on commit d60f568

Please sign in to comment.