Merge pull request #5574 from AlanCoding/req_test_dev

In requirements test, skip -e entries from pip freeze
This commit is contained in:
Alan Rominger
2017-03-01 09:21:43 -05:00
committed by GitHub

View File

@@ -13,14 +13,21 @@ def test_env_matches_requirements_txt():
return False return False
return True 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 base_dir = settings.BASE_DIR
requirements_path = os.path.join(base_dir, '../', 'requirements/requirements.txt') requirements_path = os.path.join(base_dir, '../', 'requirements/requirements.txt')
reqs_actual = [] reqs_actual = []
xs = freeze.freeze(local_only=True) xs = freeze.freeze(local_only=True)
for x in xs: for x in xs:
if '## The following requirements were added by pip freeze' in x: if skip_line(x):
break continue
x = x.lower() x = x.lower()
(pkg_name, pkg_version) = x.split('==') (pkg_name, pkg_version) = x.split('==')
reqs_actual.append([pkg_name, pkg_version]) reqs_actual.append([pkg_name, pkg_version])
@@ -31,11 +38,7 @@ def test_env_matches_requirements_txt():
line = line.partition('#')[0] line = line.partition('#')[0]
line = line.rstrip().lower() line = line.rstrip().lower()
# TODO: process git requiremenst and use egg # TODO: process git requiremenst and use egg
if line == '': if skip_line(line):
continue
if line.strip().startswith('#') or line.strip().startswith('git'):
continue
if line.startswith('-e'):
continue continue
''' '''