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 23, 2024
1 parent 73ad036 commit 3f430a9
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/sphinxcontrib/towncrier/_fragment_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,26 @@ 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
# pylint: disable-next=too-many-function-args
# pylint: disable-next=unexpected-keyword-arg
_fragments, fragment_filenames = find_fragments(

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

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L75

Added line #L75 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 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
# Towncrier >= 24.7.0rc1
_fragments, fragment_filenames = find_fragments( # noqa: WPS121

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

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L84

Added line #L84 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 90 in src/sphinxcontrib/towncrier/_fragment_discovery.py

View check run for this annotation

Codecov / codecov/patch

src/sphinxcontrib/towncrier/_fragment_discovery.py#L90

Added line #L90 was not covered by tests

return set(fragment_filenames)

0 comments on commit 3f430a9

Please sign in to comment.