Skip to content

Commit

Permalink
Adding version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheshuk committed Dec 2, 2024
1 parent 1ad71b8 commit 99c4534
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions python/snewpy/test/test_00_init.py
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__

0 comments on commit 99c4534

Please sign in to comment.