Skip to content
Permalink
Browse files

Do not use unnecessary constraints for Django version. (#364)

* Do not use unnecessary constraints for Django version.

* Add Django constraint for requirements-google.txt.

* Fix
  • Loading branch information...
wangxf123456 committed May 28, 2019
1 parent 4dd6537 commit d316b1e45357761e2b124143e6e12ce34ef6f975
@@ -530,6 +530,11 @@ def _generate_requirements_google(
if existing_requirements:
google_requirements -= existing_requirements

# We expect the existing requirements.txt is valid. So if it is
# valid, then it must explicitly or implicitly have "Django" as an
# dependency. We do not need to list "Django" as dependency again.
google_requirements.discard('django')

with open(template_path) as requirements_file:
lines = [
line for line in requirements_file.read().splitlines()
@@ -1,4 +1,4 @@
Django>=2.1.7
Django>=2.1
wheel>=0.31.1
gunicorn>=19.9.0
psycopg2-binary>=2.7.5
@@ -530,6 +530,22 @@ def test_generate_requirements_in_subdirectory(self):
file_content)
self.assertIn('-r requirements/prod.txt', file_content)

def test_do_not_include_django_for_existing_projects(self):
project_name = 'test_cloud_dependencies_from_existing'
packages = ['six']
management.call_command('startproject', project_name, self._project_dir)
requirements_file_path = os.path.join(self._project_dir,
self._generator._REQUIREMENTS)
with open(requirements_file_path, 'wt') as f:
f.write('\n'.join(packages))
self._generator.generate_from_existing(self._project_dir,
requirements_file_path)
requirements_file_path = os.path.join(
self._project_dir, self._generator._REQUIREMENTS_GOOGLE)
with open(requirements_file_path) as f:
file_content = f.read()
self.assertNotIn('Django', file_content)

def test_generate_twice(self):
self._generator.generate_new(self._project_dir)
self._generator.generate_new(self._project_dir)
@@ -33,7 +33,7 @@
# See https://github.com/kennethreitz/requests/blob/master/setup.py#L47
'urllib3>=1.23,<1.25',
'oauth2client>=4.1.2',
'django>=2.1.5',
'django>=1.11',
'backoff>=1.8.0',
'jinja2>=2.10',
'docker>=3.4.1',

0 comments on commit d316b1e

Please sign in to comment.
You can’t perform that action at this time.