Skip to content

Commit

Permalink
Take into account the base check when bumping the dependencies (#16365)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentClarret authored Dec 8, 2023
1 parent 4f4cf10 commit f470af7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions ddev/changelog.d/16365.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take into account the base check when bumping the dependencies
1 change: 1 addition & 0 deletions ddev/src/ddev/cli/dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def read_check_dependencies(repo, integrations=None):
integrations = [repo.integrations.get(integration) for integration in integrations]
elif integrations is None:
integrations = list(repo.integrations.iter_agent_checks('all'))
integrations.append(repo.integrations.get('datadog_checks_base'))
else:
integrations = [repo.integrations.get(integrations)]

Expand Down
10 changes: 7 additions & 3 deletions ddev/tests/cli/test_dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_freeze(ddev, fake_repo):
def test_sync(ddev, fake_repo):
create_integration(fake_repo, 'foo', ['dep-a==1.0.0', 'dep-b==3.1.4'])
create_integration(fake_repo, 'bar', ['dep-a==1.0.0'])
create_integration(fake_repo, 'datadog_checks_base', ['dep-a==1.0.0'])

requirements = """
dep-a==1.1.1
Expand All @@ -75,10 +76,11 @@ def test_sync(ddev, fake_repo):
result = ddev('dep', 'sync')

assert result.exit_code == 0
assert result.output == 'Files updated: 2\n'
assert result.output == 'Files updated: 3\n'

assert_dependencies(fake_repo, 'foo', ['dep-a==1.1.1', 'dep-b==3.1.4'])
assert_dependencies(fake_repo, 'bar', ['dep-a==1.1.1'])
assert_dependencies(fake_repo, 'datadog_checks_base', ['dep-a==1.1.1'])


class TestUpdates:
Expand Down Expand Up @@ -135,6 +137,7 @@ def test_show_updates(self, ddev):
def test_sync(self, ddev):
self.add_integration('foo', ['dep-a==1.0.0', 'dep-b==3.1.4'])
self.add_integration('bar', ['dep-a==1.0.0'])
self.add_integration('datadog_checks_base', ['dep-a==1.0.0', 'dep-b==3.1.4'])
self.write_requirements()

self.add_pypi_entry(
Expand All @@ -151,13 +154,14 @@ def test_sync(self, ddev):
assert result.exit_code == 0
assert (
result.output
== '''Files updated: 2
== '''Files updated: 3
Updated 1 dependencies
'''
)

assert_dependencies(self.repo, 'foo', ['dep-a==1.2.3', 'dep-b==3.1.4'])
assert_dependencies(self.repo, 'bar', ['dep-a==1.2.3'])
assert_dependencies(self.repo, 'datadog_checks_base', ['dep-a==1.2.3', 'dep-b==3.1.4'])

requirements = self.requirements_path.read_text()
expected = """
Expand Down Expand Up @@ -296,7 +300,7 @@ def assert_dependencies(root, name, dependencies):

def create_integration(root, name, dependencies):
integration_dir = root / name
integration_dir.mkdir()
integration_dir.mkdir(exist_ok=True)
with open(integration_dir / 'pyproject.toml', 'wb') as f:
tomli_w.dump({'project': {'optional-dependencies': {'deps': dependencies}}}, f)

Expand Down

0 comments on commit f470af7

Please sign in to comment.