unit test to check that version in docs matches version in spec
This commit is contained in:
parent
c279a2a02b
commit
60b4ede377
1 changed files with 32 additions and 0 deletions
32
tests/test_docs_version.py
Normal file
32
tests/test_docs_version.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import os
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
# docs version lives in docs/source/conf.py
|
||||
TOPDIR = os.path.dirname(__file__) + '/..'
|
||||
SPHINX_CONF = TOPDIR + '/docs/source/conf.py'
|
||||
|
||||
import imp
|
||||
sphinx_conf = imp.load_source('sphinx_conf', SPHINX_CONF)
|
||||
|
||||
|
||||
class TestDocsVersion(unittest.TestCase):
|
||||
|
||||
def get_spec(self):
|
||||
return TOPDIR + '/koji.spec'
|
||||
|
||||
def get_koji_version(self):
|
||||
spec = self.get_spec()
|
||||
cmd = ['rpm', '-q', '--specfile', spec, '--qf', '%{version}\\n']
|
||||
output = subprocess.check_output(cmd)
|
||||
# rpm outputs a line for each subpackage
|
||||
version = output.splitlines()[0]
|
||||
return version
|
||||
|
||||
def test_docs_version(self):
|
||||
koji_version = self.get_koji_version()
|
||||
self.assertEqual(koji_version, sphinx_conf.release)
|
||||
# docs 'version' is x.y instead of x.y.z
|
||||
dver = '.'.join(koji_version.split('.')[:-1])
|
||||
self.assertEqual(dver, sphinx_conf.version)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue