Skip to content

Commit

Permalink
Work with setuptools_scm 7.1 (fix #25) (#26)
Browse files Browse the repository at this point in the history
Make test_write less brittle (see also #8, #9) so that it works with
_version.py files generated by at least setuptools_scm 7.1, 7.0, and
6.x.
  • Loading branch information
musicinmybrain authored Jan 5, 2023
1 parent 5f949fe commit 47364fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ def test_write(new_project_write):
assert os.path.isfile(version_file)

lines = read_file(version_file).splitlines()
assert lines[3].startswith(('version =', '__version__ ='))
assert lines[3].endswith("version = '1.2.3'")
version_starts = ('version = ', '__version__ = ')
assert any(line.startswith(version_starts) for line in lines)
version_line = next(line for line in lines if line.startswith(version_starts))
assert version_line.endswith(" = '1.2.3'")


@pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only')
Expand Down

0 comments on commit 47364fa

Please sign in to comment.