-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import snewpy | ||
import unittest | ||
import importlib | ||
import subprocess | ||
|
||
def test_version_exists(): | ||
assert hasattr(snewpy, '__version__') | ||
|
||
class TestInit(unittest.TestCase): | ||
def test_version_exists(self): | ||
self.assertTrue(hasattr(snewpy, '__version__')) | ||
def test_version_is_consistent_with_variable(): | ||
assert importlib.metadata.version('snewpy') == snewpy.__version__ | ||
|
||
def test_version_is_consistent_with_git_tag(): | ||
git_tag = subprocess.check_output('git describe --abbrev=0'.split()) | ||
git_tag = git_tag.decode('ascii').strip().lstrip('v') | ||
assert git_tag == snewpy.__version__ |