Skip to content
Snippets Groups Projects
Commit 4030bd8d authored by Markus Holzer's avatar Markus Holzer
Browse files

Added test case for version number

parent 8eb74b7b
No related branches found
No related tags found
1 merge request!197Added version number to pystencils
...@@ -22,16 +22,16 @@ except ImportError: ...@@ -22,16 +22,16 @@ except ImportError:
pass pass
def _get_file_path(): def _get_release_file():
import os.path import os.path
file_path = os.path.abspath(os.path.dirname(__file__)) file_path = os.path.abspath(os.path.dirname(__file__))
return os.path.join(file_path, '..', 'RELEASE-VERSION') return os.path.join(file_path, '..', 'RELEASE-VERSION')
try: try:
__version__ = open(_get_file_path(), 'r').read() __version__ = open(_get_release_file(), 'r').read()
except IOError: except IOError:
__version__ = 'Please install pystencils with setup.py' __version__ = 'development'
__all__ = ['Field', 'FieldType', 'fields', __all__ = ['Field', 'FieldType', 'fields',
'TypedSymbol', 'TypedSymbol',
......
import pystencils as ps
from pathlib import Path
def test_version_string():
file_path = Path(__file__).parent
release_version = file_path.parent.absolute() / 'RELEASE-VERSION'
if release_version.exists ():
with open(release_version, "r") as f:
version = f.read()
assert ps.__version__ == version
else:
ps.__version__ == "development"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment