You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2022/07/11 17:39:22 UTC

[cassandra-dtest] branch trunk updated: Use own copytree instead of distutils

This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c40973f6 Use own copytree instead of distutils
c40973f6 is described below

commit c40973f6376fd80e5e0b5efddaa488a23ff1793a
Author: Brandon Williams <br...@apache.org>
AuthorDate: Mon Jul 11 11:35:37 2022 -0500

    Use own copytree instead of distutils
    
    Patch by brandonwilliams; reviewed by maedhroz for CASSANDRA-17730
---
 tools/files.py | 10 ++++++++++
 ttl_test.py    |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/files.py b/tools/files.py
index 7f0cd970..ea313ce8 100644
--- a/tools/files.py
+++ b/tools/files.py
@@ -4,6 +4,7 @@ import re
 import sys
 import tempfile
 import logging
+import shutil
 
 logger = logging.getLogger(__name__)
 
@@ -40,3 +41,12 @@ def size_of_files_in_dir(dir_name, verbose=True):
     if verbose:
         logger.debug('getting sizes of these files: {}'.format(files))
     return sum(os.path.getsize(f) for f in files)
+
+def copytree(src, dst, symlinks=False, ignore=None):
+    for item in os.listdir(src):
+        s = os.path.join(src, item)
+        d = os.path.join(dst, item)
+        if os.path.isdir(s):
+            shutil.copytree(s, d, symlinks, ignore)
+        else:
+            shutil.copy2(s, d)
diff --git a/ttl_test.py b/ttl_test.py
index 7ebebae6..4039434b 100644
--- a/ttl_test.py
+++ b/ttl_test.py
@@ -4,7 +4,6 @@ import pytest
 import logging
 
 from collections import OrderedDict
-from distutils import dir_util
 from distutils.version import LooseVersion
 
 from cassandra import ConsistencyLevel, InvalidRequest
@@ -14,6 +13,7 @@ from cassandra.util import sortedset
 from dtest import Tester, create_ks
 from tools.assertions import (assert_all, assert_almost_equal, assert_none,
                               assert_row_count, assert_unavailable)
+from tools.files import copytree
 
 since = pytest.mark.since
 logger = logging.getLogger(__name__)
@@ -591,7 +591,7 @@ class TestRecoverNegativeExpirationDate(TestHelper):
         corrupt_sstable_dir = os.path.join('sstables', 'ttl_test', version)
         table_dir = self.get_table_paths('ttl_table')[0]
         logger.debug("Copying sstables from {} into {}", corrupt_sstable_dir, table_dir)
-        dir_util.copy_tree(corrupt_sstable_dir, table_dir)
+        copytree(corrupt_sstable_dir, table_dir)
 
         logger.debug("Load corrupted sstable")
         node.nodetool('refresh ks ttl_table')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org