-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid passing an emptry string as the
tag_regex
parameter to `setup…
…tools_scm.get_version` (#68)
- Loading branch information
1 parent
e186a8b
commit 48e8aba
Showing
5 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,8 @@ def create_project(directory, metadata, *, setup_vcs=True, nested=False): | |
git('config', '--local', 'user.email', '[email protected]') | ||
git('add', '.') | ||
git('commit', '-m', 'test') | ||
git('tag', '1.2.3') | ||
# TODO: Confirm that creating a tag without a message locally causes tests to hang | ||
git('tag', '1.2.3', '-m', 'test') | ||
|
||
if nested: | ||
os.chdir(project_dir) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# SPDX-FileCopyrightText: 2022-present Ofek Lev <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
import warnings | ||
|
||
import pytest | ||
|
||
from hatch_vcs.version_source import VCSVersionSource | ||
|
@@ -20,6 +22,23 @@ def test_not_string(self, new_project_basic): | |
with pytest.raises(TypeError, match='option `tag-pattern` must be a string'): | ||
_ = version_source.config_tag_pattern | ||
|
||
def test_no_tag_pattern(self, new_project_basic): | ||
config = {} | ||
version_source = VCSVersionSource(new_project_basic, config) | ||
|
||
assert version_source.config_tag_pattern == '' | ||
|
||
# Should not raise any deprecation warnings | ||
with warnings.catch_warnings(): | ||
warnings.simplefilter('error') | ||
_ = version_source.get_version_data() | ||
|
||
def test_custom_tag_pattern_get_version(self, new_project_basic): | ||
config = {'tag-pattern': '(?P<version>.+)'} | ||
version_source = VCSVersionSource(new_project_basic, config) | ||
|
||
assert version_source.get_version_data() == {'version': '1.2.3'} | ||
|
||
|
||
class TestFallbackVersion: | ||
def test_correct(self, new_project_basic): | ||
|