From 363964831e93f529d9bce033580c2df95b7d09c9 Mon Sep 17 00:00:00 2001 From: Israel Fruchter Date: Mon, 25 Nov 2024 10:31:36 +0200 Subject: [PATCH] scylla_repository.py: attend to python 3.12 related warnings taking care about warnings around unsafe usage of the built-in tarlib --- .github/workflows/nix.yml | 4 ++-- ccmlib/scylla_repository.py | 6 +++++- pytest.ini | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 76013942..b596aee1 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -43,11 +43,11 @@ jobs: - name: Test with pytest (python 3.9) run: | - nix develop --command python3.9 -m pytest ./tests -x + nix develop --command python3.9 -m pytest ./tests -x -W ignore - name: Test with pytest (python 3.11) run: | - nix develop --command python3.11 -m pytest ./tests -x + nix develop --command python3.11 -m pytest ./tests -x -W ignore - name: Copy logs/results if: contains(github.event.pull_request.labels.*.name, 'PR-upload-log') diff --git a/ccmlib/scylla_repository.py b/ccmlib/scylla_repository.py index 7d92564e..b3e9d6d4 100644 --- a/ccmlib/scylla_repository.py +++ b/ccmlib/scylla_repository.py @@ -519,7 +519,11 @@ def download_version(version, url=None, verbose=False, target_dir=None, unified= if verbose: print(f"Extracting {target} ({url}, {target_dir}) as version {version} ...") tar = tarfile.open(target) - tar.extractall(path=target_dir) + if sys.version_info >= (3, 12): + kwargs = {'path': target_dir, 'filter': 'data'} + else: + kwargs = {'path': target_dir} + tar.extractall(**kwargs) tar.close() # if relocatable package format >= 2, need to extract files under subdir diff --git a/pytest.ini b/pytest.ini index f8b3af7f..43b43827 100644 --- a/pytest.ini +++ b/pytest.ini @@ -15,3 +15,7 @@ markers = reloc: Run tests with relocatable packages cassandra: Run tests with cassandra binaries repo_tests: Run test for testing get versions + +filterwarnings = + error + ignore::ResourceWarning