Skip to content

Commit

Permalink
Remove duplicated function(and pytest helper)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Algarvio <[email protected]>
  • Loading branch information
s0undt3ch committed Dec 14, 2023
1 parent b104d98 commit 33925e7
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions tests/support/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import salt.utils.files
from tests.conftest import CODE_DIR
from tests.support.pytest.helpers import TestAccount
from tests.support.pytest.helpers import TestAccount, download_file

ARTIFACTS_DIR = CODE_DIR / "artifacts" / "pkg"

Expand Down Expand Up @@ -1494,15 +1494,3 @@ def __enter__(self):

def __exit__(self, *args):
self.session.__exit__(*args)


@pytest.helpers.register
def download_file(url, dest, auth=None):
# NOTE the stream=True parameter below
with requests.get(url, stream=True, auth=auth) as r:
r.raise_for_status()
with salt.utils.files.fopen(dest, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
if chunk:
f.write(chunk)
return dest

0 comments on commit 33925e7

Please sign in to comment.