def test_version_expected(): """validate __version__ meets expectations""" #TODO: meaningless test? with open(VERSION_FILEPATH, 'r') as v_fh: version_from_file = v_fh.read() version_from_file = version_from_file.replace('v', '') assert version_from_file == version.__version__ assert version_from_file == p_version.get_version(PROJECT_HERE_PATH)
def get_version(): """find current version information Returns: (str): version information """ if not INSTALLED: warnings.warn('Unable to resolve package version until installed', UserWarning) return '0.0.0' #can't parse version without stuff installed return p_version.get_version(HERE)
def get_version(): """find current version information Returns: (str): version information """ if not INSTALLED: warnings.warn( 'Unable to resolve package version until installed', UserWarning ) return '0.0.0' #can't parse version without stuff installed return p_version.get_version(HERE)
def test_travis_tag_testmode(): """validate testmode can reach expected path""" old_environ = os.environ.get('TRAVIS_TAG') p_version.TEST_MODE = True if not old_environ: os.environ['TRAVIS_TAG'] = 'DUMMY' with pytest.warns(exceptions.ProsperVersionTestModeWarning): travis_version = p_version.get_version(PROJECT_HERE_PATH) assert travis_version == version.__version__ ## return environ to as expected p_version.TEST_MODE = False if old_environ: os.environ['TRAVIS_TAG'] = old_environ
def get_version(): """find current version information Returns: (str): version information """ if not INSTALLED: try: with open('version.txt', 'r') as v_fh: return v_fh.read() except Exception: warnings.warn('Unable to resolve package version until installed', UserWarning) return '0.0.0' #can't parse version without stuff installed return p_version.get_version(HERE)
def get_version(): """find current version information Returns: (str): version information """ if not INSTALLED: try: with open('version.txt', 'r') as v_fh: return v_fh.read() except Exception: warnings.warn( 'Unable to resolve package version until installed', UserWarning ) return '0.0.0' #can't parse version without stuff installed return p_version.get_version(HERE)
def test_version_installed_as_dep(): """validate expected return when installed as dependency""" # Prep a dummy version virtualenv_name = 'DUMMY_VENV' dummy_version = '9.9.9' python_version = 'python{major}.{minor}'.format( major=sys.version_info[0], minor=sys.version_info[1] ) virtualenv_path = path.join( HERE, virtualenv_name, 'lib', python_version, 'site-packages/prosper/common') os.makedirs(virtualenv_path, exist_ok=True) with open(path.join(virtualenv_path, 'version.txt'), 'w') as dummy_fh: dummy_fh.write(dummy_version) # Test the thing assert p_version.get_version(virtualenv_path) == dummy_version # Clean up yer mess shutil.rmtree(path.join(HERE, virtualenv_name))