unittests: Fix warning about distutils deprecation

unittests/rewritetests.py:19: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
This commit is contained in:
Nirbheek Chauhan 2022-01-28 15:02:31 +05:30 committed by Nirbheek Chauhan
parent 2512c25c0b
commit 19684d23e8
1 changed files with 5 additions and 2 deletions

View File

@ -15,9 +15,10 @@
import subprocess
import json
import os
import shutil
import unittest
from distutils.dir_util import copy_tree
from mesonbuild.mesonlib import windows_proof_rmtree
from .baseplatformtests import BasePlatformTests
class RewriterTests(BasePlatformTests):
@ -26,7 +27,9 @@ class RewriterTests(BasePlatformTests):
self.maxDiff = None
def prime(self, dirname):
copy_tree(os.path.join(self.rewrite_test_dir, dirname), self.builddir)
if os.path.exists(self.builddir):
windows_proof_rmtree(self.builddir)
shutil.copytree(os.path.join(self.rewrite_test_dir, dirname), self.builddir)
def rewrite_raw(self, directory, args):
if isinstance(args, str):