Skip to content

Commit

Permalink
Add test to ensure bootstrap reqs are good (#15733)
Browse files Browse the repository at this point in the history
* Add test to ensure bootstrap reqs are good

* Give full diff list in assert
  • Loading branch information
AlanCoding authored Jan 13, 2025
1 parent 6228fe9 commit fb12c83
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions awx/main/tests/functional/test_python_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@
from django.conf import settings


def test_bootstrap_consistent():
with open('Makefile', 'r') as f:
mk_data = f.read()
bootstrap_reqs = None
for line in mk_data.split('\n'):
if line.startswith('VENV_BOOTSTRAP'):
parts = line.split()
bootstrap_reqs = parts[parts.index('?=') + 1 :]
break
else:
raise RuntimeError('Cound not find bootstrap line')

req_data = None
with open('requirements/requirements.txt', 'r') as f:
req_data = f.read()

different_requirements = []
for req in bootstrap_reqs:
boot_req_name, _ = req.split('=', 1)
for line in req_data.split('\n'):
if '=' not in line:
continue
req_name, _ = line.split('=', 1)
if req_name == boot_req_name:
if req != line:
different_requirements.append((req, line))
break

assert not different_requirements


@pytest.mark.skip(reason="This test needs some love")
def test_env_matches_requirements_txt():
from pip.operations import freeze
Expand Down

0 comments on commit fb12c83

Please sign in to comment.