From f90ba8e6a61e7ed3ff8609c2f1c66452cb16ce62 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Mon, 27 Feb 2017 12:39:05 -0500 Subject: [PATCH] small refactor of python requirement test to work in dev env --- .../functional/test_python_requirements.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/awx/main/tests/functional/test_python_requirements.py b/awx/main/tests/functional/test_python_requirements.py index 0dc48f66b8..cf937786b2 100644 --- a/awx/main/tests/functional/test_python_requirements.py +++ b/awx/main/tests/functional/test_python_requirements.py @@ -13,14 +13,21 @@ def test_env_matches_requirements_txt(): return False return True + def skip_line(line): + return ( + line == '' or line.strip().startswith('#') or + line.strip().startswith('git') or line.startswith('-e') or + '## The following requirements were added by pip freeze' in line + ) + base_dir = settings.BASE_DIR requirements_path = os.path.join(base_dir, '../', 'requirements/requirements.txt') reqs_actual = [] xs = freeze.freeze(local_only=True) for x in xs: - if '## The following requirements were added by pip freeze' in x: - break + if skip_line(x): + continue x = x.lower() (pkg_name, pkg_version) = x.split('==') reqs_actual.append([pkg_name, pkg_version]) @@ -31,11 +38,7 @@ def test_env_matches_requirements_txt(): line = line.partition('#')[0] line = line.rstrip().lower() # TODO: process git requiremenst and use egg - if line == '': - continue - if line.strip().startswith('#') or line.strip().startswith('git'): - continue - if line.startswith('-e'): + if skip_line(line): continue '''