1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/source/python-lib/cuddlefish/tests/test_version.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +import os 1.9 +import unittest 1.10 +import shutil 1.11 + 1.12 +from cuddlefish._version import get_versions 1.13 + 1.14 +class Version(unittest.TestCase): 1.15 + def get_basedir(self): 1.16 + return os.path.join(".test_tmp", self.id()) 1.17 + def make_basedir(self): 1.18 + basedir = self.get_basedir() 1.19 + if os.path.isdir(basedir): 1.20 + here = os.path.abspath(os.getcwd()) 1.21 + assert os.path.abspath(basedir).startswith(here) # safety 1.22 + shutil.rmtree(basedir) 1.23 + os.makedirs(basedir) 1.24 + return basedir 1.25 + 1.26 + def test_current_version(self): 1.27 + # the SDK should be able to determine its own version. We don't care 1.28 + # what it is, merely that it can be computed. 1.29 + version = get_versions()["version"] 1.30 + self.failUnless(isinstance(version, str), (version, type(version))) 1.31 + self.failUnless(len(version) > 0, version)