ofek / hatch-vcs

Hatch plugin for versioning with your preferred VCS
MIT License
109 stars 15 forks source link

Test compatibility with the latest setuptools_scm #50

Closed frenzymadness closed 1 year ago

frenzymadness commented 1 year ago

It seems that this assert:

https://github.com/ofek/hatch-vcs/blob/425d529cd24295311ca5b52b589a6308165fb244/tests/test_build.py#L81

no longer works with the latest setuptools_scm, because the version file newly contains typing info comment at the end of the line, see: https://github.com/pypa/setuptools_scm/pull/907/files

musicinmybrain commented 1 year ago

The exact output from

python3 -m venv _e
. _e/bin/activate
pip install -e .
pip install pytest
pytest

is

[…]
>       assert version_line.endswith(" = '1.2.3'")
E       assert False
E        +  where False = <built-in method endswith of str object at 0x7f7025df4090>(" = '1.2.3'")
E        +    where <built-in method endswith of str object at 0x7f7025df4090> = "__version__ = version = '1.2.3'  # type: str".endswith

/home/ben/src/forks/hatch-vcs/tests/test_build.py:81: AssertionError

I think I agree with the suggestion in https://src.fedoraproject.org/rpms/python-hatch-vcs/pull-request/14 to change assert version_line.endswith(" = '1.2.3'") to assert " = '1.2.3'" in version_line. I’ll open a PR.