File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ """Tests of local_git_version module."""
2+
3+ import logging
4+
5+ import unittest
6+
7+
8+ from version_query .local_git_version import QUERIED , PREDICTED
9+
10+ _LOG = logging .getLogger (__name__ )
11+
12+
13+ class Tests (unittest .TestCase ):
14+
15+ def test_queried (self ):
16+ _LOG .debug ('QUERIED: %s' , QUERIED )
17+ self .assertIsInstance (QUERIED , str )
18+
19+ def test_predicted (self ):
20+ _LOG .debug ('PREDICTED: %s' , PREDICTED )
21+ self .assertIsInstance (PREDICTED , str )
Original file line number Diff line number Diff line change 1+ """Use this module when reading the version from an attribute is needed without Python code.
2+
3+ For example, when using setuptools in pyproject.toml,
4+ one can set the version dynamically as follows:
5+
6+ [project]
7+ dynamic = ["version"]
8+ ...
9+
10+ [tool.setuptools.dynamic]
11+ version = {attr = "version_query.local_git_version.PREDICTED"}
12+ """
13+
14+ import os
15+ import pathlib
16+
17+ from .git_query import query_git_repo , predict_git_repo
18+
19+ _CURRENT_FOLDER : pathlib .Path = pathlib .Path ()
20+ _PROJECT_FOLDER : pathlib .Path = pathlib .Path (os .environ .get ('PROJECT_FOLDER' , _CURRENT_FOLDER ))
21+ QUERIED : str = query_git_repo (_PROJECT_FOLDER ).to_str ()
22+ PREDICTED : str = predict_git_repo (_PROJECT_FOLDER ).to_str ()
You can’t perform that action at this time.
0 commit comments