Browse Source

update version checking test

Daniel Wallace 6 years ago
parent
commit
8d6f5bfd71
2 changed files with 5 additions and 7 deletions
  1. 1 0
      tests/requirements.txt
  2. 4 7
      tests/unit/test_init.py

+ 1 - 0
tests/requirements.txt

@@ -6,3 +6,4 @@ git+git://github.com/saltstack/pytest-salt@master#egg=pytest-salt
 tornado<5.0.0
 salt
 CherryPy
+setuptools_scm

+ 4 - 7
tests/unit/test_init.py

@@ -4,7 +4,7 @@ from __future__ import print_function, unicode_literals, absolute_import
 import imp
 import os
 import shutil
-import subprocess
+import setuptools_scm
 
 # Import Pepper Libraries
 import pepper
@@ -15,13 +15,10 @@ def test_no_setup():
     shutil.move(setuppath, setuppath + '.bak')
     ptest = imp.load_source('ptest', os.path.join(os.path.dirname(pepper.__file__), '__init__.py'))
     shutil.move(setuppath + '.bak', setuppath)
-    assert ptest.version is None
+    assert ptest.version == setuptools_scm.get_version()
     assert ptest.sha is None
 
 
 def test_version():
-    version = subprocess.check_output(['git', 'describe']).split(b'-')
-    version = b'.'.join([version[0], b'dev' + version[1]]).decode()
-    sha = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode()
-    assert pepper.version == version
-    assert ptest.sha is None
+    assert pepper.version == setuptools_scm.get_version()
+    assert pepper.sha is None