Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test(SemVer): refine tests and remove unnecessary tests which test th... #1598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bearomorphism wants to merge 1 commit into commitizen-tools:v4-9-2
base: v4-9-2
Choose a base branch
Loading
from bearomorphism:semver-test-refactor

Conversation

Copy link
Contributor

@bearomorphism bearomorphism commented Sep 13, 2025
edited
Loading

...e behavior of library

Relate #1631

Description

  • Move the test cases next to the test suites
  • Remove tests testing the library's behavior

Checklist

Code Changes

  • Add test cases to all the changes you introduce
  • Run poetry all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Run poetry doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external) in the documentation

When running poetry doc, any broken internal documentation links will be reported in the console output like this:

INFO - Doc file 'config.md' contains a link 'commands/bump.md#-post_bump_hooks', but the doc 'commands/bump.md' does not contain an anchor '#-post_bump_hooks'.

Expected Behavior

Steps to Test This Pull Request

Additional Context

assert isinstance(SemVer2("0.0.1"), VersionProtocol)


def test_semver_sortable():
Copy link
Contributor Author

@bearomorphism bearomorphism Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need to test this. The __lt__ operator is defined in packaging library and we are not overriding it.

Copy link

codecov bot commented Sep 13, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v4-9-2@e98741c). Learn more about missing BASE report.

Additional details and impacted files
@@ Coverage Diff @@
## v4-9-2 #1598 +/- ##
=========================================
 Coverage ? 98.32% 
=========================================
 Files ? 58 
 Lines ? 2682 
 Branches ? 0 
=========================================
 Hits ? 2637 
 Misses ? 45 
 Partials ? 0 
Flag Coverage Δ
unittests 98.32% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tests/utils.py Outdated
Comment on lines 26 to 32
class VersionSchemeTestArgs(NamedTuple):
current_version: str
increment: Increment | None
prerelease: Prerelease | None
prerelease_offset: int
devrelease: int | None
expected_version: str
Copy link
Contributor Author

@bearomorphism bearomorphism Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change

@Lee-W Lee-W added this to the 4.10.0 milestone Sep 27, 2025
itertools.chain(tdd_cases, weird_cases, simple_flow, linear_prerelease_cases),
"args",
[
# test driven development
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# test driven development

I think we can remove this line. This does not provide much information

Copy link
Contributor Author

@bearomorphism bearomorphism Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

removed

Comment on lines 13 to 20
VersionSchemeTestArgs(
current_version="0.1.1",
increment="PATCH",
prerelease=None,
prerelease_offset=0,
devrelease=None,
expected_version="0.1.2",
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should make it something like this

"version_args, expected_version"

Suggested change
VersionSchemeTestArgs(
current_version="0.1.1",
increment="PATCH",
prerelease=None,
prerelease_offset=0,
devrelease=None,
expected_version="0.1.2",
),
(
VersionSchemeTestArgs(
current_version="0.1.1",
increment="PATCH",
prerelease=None,
prerelease_offset=0,
devrelease=None,,
),
"0.1.2"

The expected version probably should be viewed as a different argument

Copy link
Contributor Author

@bearomorphism bearomorphism Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

...e behavior of library, improve readability with NamedTuple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@Lee-W Lee-W Lee-W left review comments

@woile woile Awaiting requested review from woile woile is a code owner

@noirbizarre noirbizarre Awaiting requested review from noirbizarre noirbizarre is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
4.10.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /