8000 feat: add support for `test_utils.__version__` (#244) · googleapis/python-test-utils@9655669 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 9655669

Browse files
authored
feat: add support for test_utils.__version__ (#244)
* feat: add support for test_utils.__version__ * Filter lint warning
1 parent c916055 commit 9655669

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@
1414

1515
import io
1616
import os
17+
import re
1718
import setuptools # type: ignore
1819

19-
version = "1.5.0"
20+
version = None
21+
22+
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
23+
24+
with open(os.path.join(PACKAGE_ROOT, "test_utils/version.py")) as fp:
25+
version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read())
26+
assert len(version_candidates) == 1
27+
version = version_candidates[0]
2028

2129
package_root = os.path.abspath(os.path.dirname(__file__))
2230

test_utils/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
from .version import __version__ # noqa: F401

test_utils/version.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
__version__ = "1.5.0"

0 commit comments

Comments
 (0)
0