|
rdobuilder |
65d599 |
From 2bf0d32f92f6609258f85131b94d0952fc0ec149 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
65d599 |
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
|
rdobuilder |
65d599 |
Date: Mon, 19 Dec 2022 20:20:11 -0500
|
|
rdobuilder |
65d599 |
Subject: [PATCH] Work with setuptools_scm 7.1 (fix #25)
|
|
rdobuilder |
65d599 |
|
|
rdobuilder |
65d599 |
Make test_write less brittle (see also #8, #9) so that it works with
|
|
rdobuilder |
65d599 |
_version.py files generated by at least setuptools_scm 7.1, 7.0, and
|
|
rdobuilder |
65d599 |
6.x.
|
|
rdobuilder |
65d599 |
---
|
|
rdobuilder |
65d599 |
tests/test_build.py | 6 ++++--
|
|
rdobuilder |
65d599 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
rdobuilder |
65d599 |
|
|
rdobuilder |
65d599 |
diff --git a/tests/test_build.py b/tests/test_build.py
|
|
rdobuilder |
65d599 |
index 2fde601..7c76343 100644
|
|
rdobuilder |
65d599 |
--- a/tests/test_build.py
|
|
rdobuilder |
65d599 |
+++ b/tests/test_build.py
|
|
rdobuilder |
65d599 |
@@ -75,8 +75,10 @@ def test_write(new_project_write):
|
|
rdobuilder |
65d599 |
assert os.path.isfile(version_file)
|
|
rdobuilder |
65d599 |
|
|
rdobuilder |
65d599 |
lines = read_file(version_file).splitlines()
|
|
rdobuilder |
65d599 |
- assert lines[3].startswith(('version =', '__version__ ='))
|
|
rdobuilder |
65d599 |
- assert lines[3].endswith("version = '1.2.3'")
|
|
rdobuilder |
65d599 |
+ version_starts = ('version = ', '__version__ = ')
|
|
rdobuilder |
65d599 |
+ assert any(line.startswith(version_starts) for line in lines)
|
|
rdobuilder |
65d599 |
+ version_line = next(line for line in lines if line.startswith(version_starts))
|
|
rdobuilder |
65d599 |
+ assert version_line.endswith(" = '1.2.3'")
|
|
rdobuilder |
65d599 |
|
|
rdobuilder |
65d599 |
|
|
rdobuilder |
65d599 |
@pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only')
|